warning: missing terminating ' character compiler error for control-M characters
warning: missing terminating ' character compiler error for control-M characters
string linenotes = CharPtr;
for(int i = 0; i < linenotes.length(); i++)
if(linenotes[i] == '^M')
linenotes.replace(i, 1, "");
I have a piece of code that receives text that has control-M characters and removes those characters. But the g++ compiler gives this error.
Text_db.pc:13884:23: warning: missing terminating ' character [enabled by default]
if(linenotes[i] == '^M')
^
Text_db.pc:13884:4: error: missing terminating ' character
if(linenotes[i] == '^M')
^
Text_db.pc:13885:1: warning: missing terminating ' character [enabled by default]
{
^
Text_db.pc:13885:1: error: missing terminating ' character
Should I be looking for rn instead? Please note that aCC compiler on HPUX doesn't complain.
rn
^M
r
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
^Mis not C++ (altough some compilers may accept it as an extension), so you should definitely user.– Melebius
Feb 26 at 16:55