carriage return with stdout and stderr
Christoph Mallon
christoph.mallon at gmx.de
Sun Jul 5 12:20:40 UTC 2009
Alexander Best schrieb:
> i'm running something similar to this pseudo-code in an app of mine:
>
> for (i=0 ....)
> fprintf(stdout,"TEXT %d\r", int);
>
> what's really strange is that if i print to stdout the output isn't very
> clean. the cursor jumps randomly within the output (being 1 line). if i print
> to stderr however the output looks really nice. the cursor says right at the
> front of the output all the time. just like in burncd e.g.
>
> what's causing this? because i'd rather print to stdout.
stdout is buffered, stderr is not. Try fflush().
Christoph
More information about the freebsd-hackers
mailing list