Connecting Tech Pros Worldwide Help | Site Map

how to control position of output values on output console

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 18th, 2007, 11:15 AM
pratap
Guest
 
Posts: n/a
Default how to control position of output values on output console

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, 11:35 AM
=?ISO-8859-1?Q?Erik_Wikstr=F6m?=
Guest
 
Posts: n/a
Default 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, 01:45 PM
Obnoxious User
Guest
 
Posts: n/a
Default 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, 02:45 PM
James Kanze
Guest
 
Posts: n/a
Default 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

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.