How can I erase the current printed console line in C? I am working on a Linux system. For example -
printf("hello"); printf("bye");
I want to print bye on the same line in place of hello.
You can use VT100 escape codes. Most terminals, including xterm, are VT100 aware. For erasing a line, this is ^[[2K. In C this gives:
^[[2K
printf("%c[2K", 27);
1.4m articles
1.4m replys
5 comments
56.9k users