Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Overwriting cout screen output

Status
Not open for further replies.

Heals

Programmer
Oct 1, 2002
3
AU
Can anyone help me to find the correct code syntax for implementing the output for a console digital clock on the command line. I need the &quot;cout << &quot; code that enables the output to overwrite itself so the clock appears stationary on the command line. I have tried &quot;\r&quot; and it works fine in dos compilations but not for Linux or Unix.

Any info would be appreciated.

Cheers
 
I think you need to use curses. Look it up on the web or in your man pages if you have it installed. //Daniel
 
Have you tried &quot;\r&quot; followed by cout.flush ()?

Alternatively you may require the escape sequence for goto start of line. It is one of the shell putc/puts things but I don't know the mnemonic for it.
 
Depending on what else should be on the screen, you could try

system(&quot;clear&quot;);

on each clock update... It isn't the best way, and may not be what your looking for, but it is cheap and dirty.
 
search the net for a linux version of gotoxy and overwrite the changin digit. its there, I used it a long time ago... Greetz,
muppeteer.gif

themuppeteer@hotmail.com

Don't eat yellow snow...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top