How to go to the previous line in a C code

后端 未结 7 2097
渐次进展
渐次进展 2021-01-14 11:14

If for the following code:

printf(\"HEllo\\n\");    // do not change this line.
printf(\"\\b\\bworld\");

I need an output: Helloworld (In a

7条回答
  •  梦谈多话
    2021-01-14 11:49

    There is no platform-independent control character to move back up a line. This harkens back to the days of line printers, where printf actually would print a line of text onto a sheet of paper and there was no way of retracting the paper to overwrite what had already been printed.

    That said, there are libraries like ncurses that let you move the cursor around the console. They're just not part of the standard libraries.

提交回复
热议问题