Reputation: 1
I need to erase a printed character in a new line from the end.
That is if the statement is printf("C++")
I need to erase those 2 "++" printed and get the output "C".
printf("hello"); printf("\rbye");
Using the above escape sequence '\r', replaces it only from the printed line beginning to get the output 'byelo', how to do it from the end to get 'hebye'?
Upvotes: 0
Views: 294
Reputation: 32826
You can use the backspace ASCII character:
printf("hello");
printf("\b");
Result:
hell
UPD: see also this answer
Upvotes: 1