how to go back on previous line with printf
David Haddon
Dave.Haddon at csiro.au
Mon Sep 1 18:37:29 CDT 2008
On Sun, 2008-08-31 at 23:52 -0700, pauljoseph wrote:
> Hi,
> Is there anyway we can move the cursor back to the previous line using
> printf? For example if I do
>
> printf('test line 1.\n');
>
> The \n will change to the next line. May I know what character I can use to
> go back to the "test line 1." and put the cursor back after the dot?
>
> Thanks.
If you use '\r' that will take you to the beginning of the line.
for i = 1:10
printf("Line %d of 10 \r",i)
endfor
This will print the message on the same line in a standard Octave shell.
When testing it, I found that it doesn't work under the QtOctave
though... QtOctave does make some changes though.
I hope this helps.
David
More information about the Help-octave
mailing list