Connecting Tech Pros Worldwide Help | Site Map

how to control position of output values on output console

pratap
Guest
 
Posts: n/a
#1: Jul 18 '07
I have an application which periodically gives me an output of sonar
values .However i am unable to view the values as they get replaced by
the new ones below in realtime and are displayed after the previous
output is displayed. Is there any mechanism in C++ where i can fix
position of the string on console e.g. "sonar 0 =" and the output
147.000 gets replaced by the new value as the new reading gets read.
This way the results would be more visible.

sonar 0 = 147.000000 sonar 1 = 19.700000 sonar 2 =
282.400000 sonar 3 = 491.000000 sonar 4 = 348.000000 sonar 5
= 220.300000 sonar 6 = 106.900000 sonar 7 = 301.30000

Regards
Pratap

=?ISO-8859-1?Q?Erik_Wikstr=F6m?=
Guest
 
Posts: n/a
#2: Jul 18 '07

re: how to control position of output values on output console


On 2007-07-18 13:13, pratap wrote:
Quote:
I have an application which periodically gives me an output of sonar
values .However i am unable to view the values as they get replaced by
the new ones below in realtime and are displayed after the previous
output is displayed. Is there any mechanism in C++ where i can fix
position of the string on console e.g. "sonar 0 =" and the output
147.000 gets replaced by the new value as the new reading gets read.
This way the results would be more visible.
There's no way to do that with the standard IO capabilities of C++, you
have to use some third-party library, which depends on your platform.

--
Erik Wikström
Obnoxious User
Guest
 
Posts: n/a
#3: Jul 18 '07

re: how to control position of output values on output console


On Wed, 18 Jul 2007 11:13:21 +0000, pratap wrote:
Quote:
I have an application which periodically gives me an output of sonar
values .However i am unable to view the values as they get replaced by
the new ones below in realtime and are displayed after the previous
output is displayed. Is there any mechanism in C++ where i can fix
position of the string on console e.g. "sonar 0 =" and the output
147.000 gets replaced by the new value as the new reading gets read.
This way the results would be more visible.
>
sonar 0 = 147.000000 sonar 1 = 19.700000 sonar 2 =
282.400000 sonar 3 = 491.000000 sonar 4 = 348.000000 sonar 5
= 220.300000 sonar 6 = 106.900000 sonar 7 = 301.30000
>
Try ncurses, or something similar.

--
Obnoxious User
James Kanze
Guest
 
Posts: n/a
#4: Jul 19 '07

re: how to control position of output values on output console


On Jul 18, 1:27 pm, Erik Wikström <Erik-wikst...@telia.comwrote:
Quote:
On 2007-07-18 13:13, pratap wrote:
Quote:
Quote:
I have an application which periodically gives me an output of sonar
values .However i am unable to view the values as they get replaced by
the new ones below in realtime and are displayed after the previous
output is displayed. Is there any mechanism in C++ where i can fix
position of the string on console e.g. "sonar 0 =" and the output
147.000 gets replaced by the new value as the new reading gets read.
This way the results would be more visible.
Quote:
There's no way to do that with the standard IO capabilities of C++, you
have to use some third-party library, which depends on your platform.
If the values are all on one line, outputting enough '\b' and
then rewriting the entire line will usually work. (Not that I'd
really recommend it.) Otherwise, curses/ncurses is pretty much
the de facto standard.

--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Closed Thread