erasing and writing test on console. 
Author Message
 erasing and writing test on console.

I need to write an interactive application to help download files from
the internet. At one point, I need the output to display the status of
the download (like apt-get in debian) i.e. it would be one line saying:

  file: dddddd.ddd     size: xxx bytes     zzzz bytes downloaded

where the 'zzzz bytes downloaded' is updated.
Do I need to use curses to do this, or is there a simpler way just using
the standard print and an erase function that I haven't heard of?

Thanks for any help,

John Travers



Sat, 03 Aug 2002 03:00:00 GMT  
 erasing and writing test on console.

Quote:

>where the 'zzzz bytes downloaded' is updated.
>Do I need to use curses to do this, or is there a simpler way just using
>the standard print and an erase function that I haven't heard of?

Not the most elegant way, but one that usually works: set your print
up so you are not emitting a new line. Then emit enough backspace characters
to get back to the zzzz, and print the new number.


Sat, 03 Aug 2002 03:00:00 GMT  
 erasing and writing test on console.

Quote:


>>where the 'zzzz bytes downloaded' is updated.
>>Do I need to use curses to do this, or is there a simpler way just using
>>the standard print and an erase function that I haven't heard of?

>Not the most elegant way, but one that usually works: set your print
>up so you are not emitting a new line. Then emit enough backspace characters
>to get back to the zzzz, and print the new number.

Alternatively, you can emit '\r' without the '\n'.  Then reprint the entire
line.  The zzzz will change as appropriate.  It's a lot easier than
determining howmany backspaces to emit.

HTH,
Steve



Sat, 03 Aug 2002 03:00:00 GMT  
 erasing and writing test on console.

Quote:
> >>where the 'zzzz bytes downloaded' is updated.
> >>Do I need to use curses to do this, or is there a simpler way
> Alternatively, you can emit '\r' without the '\n'.  Then reprint the entire
> line.

Thank you, it works perfectly.


Sat, 03 Aug 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Writing to the console in MVS systems

2. Writing to the console on MVS systems

3. writing to console

4. Writing to Win32 console - MASM

5. Anyone writing console apps using win32api ?

6. CR/LF Control With WRITEs to Console

7. write to console from C in WIN32

8. spectcl console write error

9. Test::Unit::UI::Console::TestRunner suggestions

10. Testing DOS Console app using TCL/Expect

11. windows compile tcl8.3.4 wish83 console not showing test widget

12. Hiding the DOS console on a console application on Windows

 

 
Powered by phpBB® Forum Software