Wednesday, January 4, 2012

How do we move the cursor to the beginning of the current line?

The escape sequence \r in the printf() format string

printf("I earned $50 \r Where is the money?\n");

will not display any character before \r. The escape sequence \r represents a carriage return and moves the cursor to the beginning of the current line.

No comments:

Post a Comment