Let's suppose we have a terminal, and our program has printed some text:
line 1
line 2
line 3
And we seek back to the beginning of line 3. I want to print some text without it overwriting previously printed text (I don't want to use ncurse), so I want it to look like:
line 1
line 2
inserted line
line 3
If I just print a \n
, I'll get weird formatting.
Is there any way to do this?
For more info:
I have another thread logging some data, and a > for user input, so like this:
[info]: log
> command
and as it logs some more, it should look like:
[info]: log
[info]: more log
>command
No, it different from this post. On the last line, I don't know what the user inputs, so I can't just reprint it. Maybe turning off buffering (so I can get input without the user pressing enter), and also disable character echoing so I can fully manipulate the terminal, but that would be too complicated, and I don't know who to disable echo on windows.