std:string str("text1\; text2\;");
How come VS2005 says ; unrecognized character escape sequence.
Please advise, thanks.
std:string str("text1\; text2\;");
How come VS2005 says ; unrecognized character escape sequence.
Please advise, thanks.
Just put the semicolon with no backslash:
std::string str("text1; text2;");
Because this is wrong:
std:string str("text1\; text2\;");
This is correct:
std::string str("text1; text2;");
TWO colons after std.
Semicolons have absolutely no significance in C strings; they're just normal characters there. If you need to put a backslash in the string because something later requires it, it's the backslash that needs the backslash in front.
std::string str("text1\\; text2\\;");
That's because \;
is not a recognized escape sequence in C++; the compiler rightly wants to know what on earth you're talking about when you put that in.