Thread: Refresh a dos box???

  1. #1
    Useless Apprentice ryan_germain's Avatar
    Join Date
    Jun 2004

    Refresh a dos box???


    I was wondering if there was a way to refresh a dos box. Let say the output is: "Output is 9." But then, lets say i want to chhange the outpout to: "Output is 6." but i dont want to rewrite the last output, just change the 9 to a 6. Is there a way/funtion to do this?

    thx all

  2. #2
    Registered User
    Join Date
    Jul 2002


    Input to a DOS box is static, meaning the box prints the input it was given at the time. This cannot be changed since each command to print results in a line of display in the box. Therefore, the answer to your question is no.


  3. #3
    Useless Apprentice ryan_germain's Avatar
    Join Date
    Jun 2004

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Depends how much output you're intending to refresh, and what you last did

    Simple things can be achieved with
    cout << "output is 9" << cout.flush();
    // do some stuff
    cout << "\b6" << cout.flush();
    But backspace (that's the \b) only works at the end of your input.

    For random placement of refreshed text, then
    a) simple answer, redraw it all
    b) use a port ofncurses
    c) create your own version, using whatever lower-level screen access functions you have.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Plano, Texas, United States
    since you have explicitly said you are using a DOS box I can leave my ANSI Standard pedistal and offer you the gift of Borland's old libraries for DOS.

    There are several functions in there like clrscr(), gotoxy(), etc. that would help with this.

    Look for the old Borland files like Borland's version of conio.h and also dos.h.
    My Website

    "Circular logic is good because it is."

  6. #6
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    And if you are truely using DOS, you can use ANSI.SYS & escape codes.

    Hope is the first step on the road to disappointment.

  7. #7
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Since the op said "dos box", I'm gonna jump on the Win32API cat-skinning by refering to this tutorial.


  8. #8
    Useless Apprentice ryan_germain's Avatar
    Join Date
    Jun 2004
    thx everyone, im reading through the stuff...if anyone has more suggestions keep them coming

  9. #9
    Registered User
    Join Date
    Jul 2004
    As already mentioned, '\b', clrscr() are the two I would consider. gotoxy() if you need to 'fix' more than one line of output at a time. If none of those help, you should reword the question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 02-13-2008, 02:59 PM
  2. AllocConsole dos box shuts down main prog
    By johny145 in forum Windows Programming
    Replies: 6
    Last Post: 06-19-2005, 03:53 AM
  3. How to program a "back" button with MFC
    By 99atlantic in forum Windows Programming
    Replies: 3
    Last Post: 04-26-2005, 08:34 PM
  4. New Theme
    By XSquared in forum A Brief History of
    Replies: 160
    Last Post: 04-01-2004, 08:00 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM