how to go back on previous line with printf

Jaroslav Hajek highegg at gmail.com
Mon Sep 1 02:47:37 CDT 2008


On Mon, Sep 1, 2008 at 8:52 AM, pauljoseph <oka.kurniawan at gmail.com> 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?
>

AFAIK this is not possible using standard console output. For
instance, the output may be redirected to a printer, and you simply
can't go back. If your terminal supports ANSI escape sequences (most
of them do), then you can use them to accomplish this.
If you are trying to do something like progress reporting, then it's
better to not print the linefeed \n until done.

cheers

> Thanks.
> --
> View this message in context: http://www.nabble.com/how-to-go-back-on-previous-line-with-printf-tp19249702p19249702.html
> Sent from the Octave - General mailing list archive at Nabble.com.
>
> _______________________________________________
> Help-octave mailing list
> Help-octave at octave.org
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>



-- 
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz


More information about the Help-octave mailing list