keep numbers after sign

Posted on 2007-11-27
Last Modified: 2010-04-01
hello there,
I have this chars in here but instead of keeping the numbers I would like to keep the letters
the c++ source code is working fine I just would like to change it..

#include <iostream>

#include <fstream>

#include <string>

using namespace std;

int main (int argc, char** argv)  {

    if (argc != 3) {

        cout << "Usage: program  <infile> <outfile>" << endl;

        return 0;


    ifstream is;

    ofstream os;[1]);

    if (!is.is_open()) {

        cout << "Cannot open " << argv[1];

        return -1;


    if (!os.is_open()) {

        cout << "Cannot open " << argv[2];

        return -1;


    while(!is.eof()) {

        string str;


        int pos = str.find('=');

        if (-1 != pos) str.erase(pos,str.length() - pos);

        os << str << endl; // line feed was missing


    return 0;


Open in new window

Question by:Woodie2986
1 Comment

Accepted Solution

UrosVidojevic earned 125 total points
ID: 20362428
if (-1 != pos) str.erase(pos,str.length() - pos);


if (-1 != pos) str.erase(0, pos+1);

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now