How to find and replace the Enter character?


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++; }

Search \r\n for Windows format, \n for Linux/Unix format, \r for Mac format in text files.