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?
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.
Depends how much output you're intending to refresh, and what you last did
Simple things can be achieved with
But backspace (that's the \b) only works at the end of your input.
cout << "output is 9" << cout.flush();
// do some stuff
cout << "\b6" << cout.flush();
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.
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.
And if you are truely using DOS, you can use ANSI.SYS & escape codes.
Since the op said "dos box", I'm gonna jump on the Win32API cat-skinning by refering to this tutorial.
thx everyone, im reading through the stuff...if anyone has more suggestions keep them coming
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.