I’m writing a C program that accepts input one line at a time from the user. However, after the user enters the line of input, I want to either clear the line they typed from stdout, or prefix it. The former is ideal, but the latter would be acceptable for my purposes. Is there a way to do this? Tell me if I need to be more clear, I’m not sure how well I’ve described the problem.
Share
You cannot in C portably clear a line after a new line was issued.
On most POSIX systems you can use ncurses library to position the cursor and clear any line.