how to control position of output values on output console

P

pratap

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?=

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

Obnoxious User

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

James Kanze

On 2007-07-18 13:13, pratap wrote:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top