I would like to overwrite something on a line above in a serial console. Is there a character that allows me to move up?
Java supports Unicode, which has the character "REVERSE LINE FEED" (U+008D). In Java it would be '\u008D' (as a char ) or "\u008D" (as a String ).
You can try to use '\033[1A' to go back one line (substitute 1 with number of lines to jump. It will probably break in some terminals.
cout << "\n\n\n\n\n\n\n\n\n\n\xc9\xbb\n\xc8\xbc"<<flush; Sleep(50);
Most terminals understand ANSI escape codes. The relevant codes for this use case:
"\033[F"
– move cursor to the beginning of the previous line"\033[A"
– move cursor up one lineExample (Python):
print("\033[FMy text overwriting the previous line.")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With