How to Find and Replace the Enter character?

Posted by karikari on Stack Overflow See other posts from Stack Overflow or by karikari
Published on 2010-04-22T03:44:29Z Indexed on 2010/04/22 3:53 UTC
Read the original article Hit count: 180

Filed under:
|

How to Find and Replace the 'Enter' characters in the text file? Here is my code:

string searchString( "\r" );   // <------- how to look for ENTER chars?
string replaceString( "XXXX" );

assert( searchString != replaceString );

string::size_type pos = 0, pos3 =0;

while ( (pos = test.find(searchString, pos)) != string::npos ) {
    test.replace( pos, searchString.size(), replaceString );
            pos++; }

© Stack Overflow or respective owner

Related posts about visual-c++

Related posts about char