Cout rollback (C++)
I am working with C++ in Windows and would like to be able to update the console, i.e. not only write to cout, but to overwrite previously written characters (like for example chkdsk does when updating its progress).
Does anyone know how I could do this? I thought that using cout.seekp() might work, but the pointer doesn't seem to move.
Thankful for any help..
Perhaps what you're looking for is the '\r' escape sequence? It's the carriage return character, basically it just moves the cursor back to the beginning of the line. You can't use it to go back up a line, but if you just want to overwrite something you previously wrote on the same line, then it works charmingly well :)
Here is an excelent tutorial on advanced console programming topics such as this.
Thanks, guys. The carriage return works perfectly. :)