* glen_stark <st***@ifh.ee.ethz.ch> schriebt:
maybe this is more an iostream question.
I would like to output a value to a console in the following manner:
value: xx
Where xx gets updated dynamically. Is it possible using std C++ to back
up to a certain position for output?
C++ provides no such facility. That would be OK, except C++ also actively
sabotages the facility that in practice is universally available, namely
the ASCII carriage return character (ASCII character 13, which is denoted by
'\r' in C++ (but note that '\r' is not necessarily denoted by ASCII 13)).
The sabotage takes the form of possible translation of the carriage return
character, and that this possible translation can not be turned off for
the standard named iostreams, although it can be turned off for other streams.
As a consequence of that sabotage you cannot, in standard C++, write a program
that copies its standard input exactly to its standard output, like 'cat'.
I think that's horrible, but whenever it has been mentioned a very large flock
of C++ zealots have descended on the thread in question, so it's a bit touchy.
If your output is to a typical (?) text terminal, however, you can probably
use an escape sequence. Such sequences vary from terminal to terminal, but
there is an ANSI standard. If I recall correctly you'd output ASCII 27, the
escape character, followed by '[', followed by e.g. 'H' to move the text
cursor to the upper left corner of the screen -- and other sequences to
move it elsewhere, set colors, etc.
Possibly, if your output is to an emulation of a terminal in a GUI window, it
might be possible to use an ANSI driver in between your program output and the
actual presention -- e.g. there was such a driver, called ansi.sys, in
16-bit Windows, but as far as I know there is no such 32-bit Windows driver.
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?