Thread: Cout rollback (C++)

  1. #1
    Registered User
    Join Date
    Nov 2004

    Question 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..

  2. #2
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    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
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  3. #3
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Here is an excelent tutorial on advanced console programming topics such as this.


  4. #4
    Registered User
    Join Date
    Nov 2004
    Thanks, guys. The carriage return works perfectly.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. class methods to cout stream
    By shintaro in forum C++ Programming
    Replies: 5
    Last Post: 11-11-2008, 07:27 PM
  2. cout
    By RenderedAwake in forum C++ Programming
    Replies: 5
    Last Post: 02-03-2005, 07:14 AM
  3. How Does cout Work
    By jrahhali in forum C++ Programming
    Replies: 8
    Last Post: 08-25-2004, 03:19 PM
  4. cout vs std::cout
    By none in forum C++ Programming
    Replies: 10
    Last Post: 07-26-2004, 11:20 PM
  5. FAQ cout
    By evilmonkey in forum FAQ Board
    Replies: 1
    Last Post: 10-07-2001, 11:32 AM