Aug 12, 2009 #1 xwb Programmer Joined Jul 11, 2002 Messages 6,828 Location GB I'm not sure what is happening with this Code: std::ostringstream oss; oss << "??/??/??"; std::string date = oss.str(); std::cout << date.c_str(); I get \?? If I try Code: oss << "??/"; I get a warning about a newline
I'm not sure what is happening with this Code: std::ostringstream oss; oss << "??/??/??"; std::string date = oss.str(); std::cout << date.c_str(); I get \?? If I try Code: oss << "??/"; I get a warning about a newline
Aug 13, 2009 Thread starter #2 xwb Programmer Joined Jul 11, 2002 Messages 6,828 Location GB Happens with iostream as well Code: #include <iostream> int main () { std::cout << "??/??/??" << std::endl; return 0; } Looks like the / is some sort of regular expression search character. To get the result I want, I have to change it to Code: #include <iostream> int main () { std::cout << "??\/??\/??" << std::endl; return 0; } Upvote 0 Downvote
Happens with iostream as well Code: #include <iostream> int main () { std::cout << "??/??/??" << std::endl; return 0; } Looks like the / is some sort of regular expression search character. To get the result I want, I have to change it to Code: #include <iostream> int main () { std::cout << "??\/??\/??" << std::endl; return 0; }
Aug 13, 2009 Thread starter #3 xwb Programmer Joined Jul 11, 2002 Messages 6,828 Location GB Actually that gives warnings, changed to Code: #include <iostream> int main () { std::cout << "?\?/?\?/??" << std::endl; return 0; } Upvote 0 Downvote
Actually that gives warnings, changed to Code: #include <iostream> int main () { std::cout << "?\?/?\?/??" << std::endl; return 0; }
Aug 13, 2009 1 #4 uolj Programmer Joined Jul 2, 2003 Messages 529 Location GB It's a trigraph: http://en.wikipedia.org/wiki/Digraphs_and_trigraphs Scroll down to Language Support > C to see why ??/ isn't allowed in C and C++ files. Upvote 0 Downvote
It's a trigraph: http://en.wikipedia.org/wiki/Digraphs_and_trigraphs Scroll down to Language Support > C to see why ??/ isn't allowed in C and C++ files.
Aug 14, 2009 Thread starter #5 xwb Programmer Joined Jul 11, 2002 Messages 6,828 Location GB Yet another thing I didn't know about C after using it for 25 years! Upvote 0 Downvote