Connecting Tech Pros Worldwide Help | Site Map

how to control position of output values on output console

  #1  
Old July 18th, 2007, 12:15 PM
pratap
Guest
 
Posts: n/a
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

  #2  
Old July 18th, 2007, 12:35 PM
=?ISO-8859-1?Q?Erik_Wikstr=F6m?=
Guest
 
Posts: n/a

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
  #3  
Old July 18th, 2007, 02:45 PM
Obnoxious User
Guest
 
Posts: n/a

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
  #4  
Old July 19th, 2007, 03:45 PM
James Kanze
Guest
 
Posts: n/a

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit answers 0 November 14th, 2005 08:57 PM
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit answers 0 November 14th, 2005 07:46 PM
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit answers 0 November 14th, 2005 03:55 PM
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit answers 5 November 14th, 2005 12:36 PM