Update stdout instead of writing new line [message #85027] |
Mon, 24 June 2013 13:17  |
stefan.meingast
Messages: 30 Registered: June 2012
|
Member |
|
|
Hey
I had hoped that someone here might be able to answer this quick question:
I like to monitor my progress by writing stuff into the terminal, but it would be much more convenient to update the output instead of writing a new line.
e.g.:
FOR i=1,100 DO PRINT, i
writes 100 lines in the terminal. Would it be possible to overwrite the previous output so that in the end only one line is used?
Thanks for any hints :)
|
|
|
Re: Update stdout instead of writing new line [message #85028 is a reply to message #85027] |
Mon, 24 June 2013 13:29   |
Lajos Foldy
Messages: 176 Registered: December 2011
|
Senior Member |
|
|
On Monday, June 24, 2013 10:17:49 PM UTC+2, Stefan wrote:
> Hey
>
>
>
> I had hoped that someone here might be able to answer this quick question:
>
>
>
> I like to monitor my progress by writing stuff into the terminal, but it would be much more convenient to update the output instead of writing a new line.
>
>
>
> e.g.:
>
> FOR i=1,100 DO PRINT, i
>
>
>
> writes 100 lines in the terminal. Would it be possible to overwrite the previous output so that in the end only one line is used?
>
>
>
> Thanks for any hints :)
FOR i=1,100 DO PRINT, string(13b), i, format='(A,I,$)'
regards,
Lajos
|
|
|
|
|
Re: Update stdout instead of writing new line [message #85031 is a reply to message #85030] |
Mon, 24 June 2013 14:00   |
Lajos Foldy
Messages: 176 Registered: December 2011
|
Senior Member |
|
|
On Monday, June 24, 2013 10:46:40 PM UTC+2, Stefan wrote:
> Wow, quick answer, thanks!!! :)
>
>
>
> Alright, that's a very good start, this indeed writes everything into one line, but is it also possible to overwrite the previous output? In this way I would end up with VERY long lines. :)
Have you tried my suggestion? 13b is carriage return, i.e. go to the beginning of line.
FOR i=1,100 DO PRINT, string(13b), i, format='(A,I,$)'
regards,
Lajos
|
|
|
|
|
|