YarvinG Liu said:
i write two codes:
printf("123\r");
printf("123\n");
the lattar. as we all know. the output will be:
123
press any key to continue
but the formmer will be:
press any key to continue
which means data:123 has lost.
Right.
Y?
I don't understand. If you mean "Why?", however, the answer is that writing
a '\r' character to the standard output stream moves the active position
to the initial position of the current line. It would seem that your IDE
then writes "press any key to continue" to the standard output stream,
starting at that position, and therefore overwriting your "123" text.
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999