"Mark B" <so***@localbar.com> writes:
"Mike Wahler" <mk******@mkwahler.net> wrote in message
news:wJ*****************@newsread2.news.pas.earthl ink.net...
"ern" <er*******@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com... printf("C:\myfile.txt");
prints as
C:myfile.txt
I doubt that. I suspect the compiler complained.
(because there's no '\m' character).
I doubt *any* of my compilers would complain about that...
which compiler do you use which *does* check for and
report issues with invalid escape sequences in format
strings?
Did you try it?
It's not an invalid format string, it's an invalid string literal.
puts("C:\myfile.txt") would have the same problem.
Strictly speaking, "C:\myfile.txt" isn't a string literal at all. The
compiler is required to issue a diagnostic, as it would for any syntax
error. At least one compiler then proceeds to generate code as if the
literal "C:yfile.txt" had appeared.
--
Keith Thompson (The_Other_Keith)
ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.