C programming problem - stdout output goes AWOL

Alan Kennington ak.linuxsa at topology.org
Fri May 30 20:33:02 CST 2003

On Fri, May 30, 2003 at 04:47:03PM +0930, Alan Kennington wrote:
> I write an ANSI C program which just whips great chunks of
> data to the screen - just ascii in nice little lines less than
> 80 characters long, once every 4 seconds.
> But the last 10-20 lines of each screenful just disappear completely,
> broken in the middle of a line.
> Clearly some buffer is overflowing somewhere.

Not that this is an answer (to my own question) really, but the above
problem gets fixed by inserting a usleep(10000) every half a page
or so of output. Somehow that 10 mSec delay lets the "xterm" terminal emulator
catch up with its duties of absorbing bytes and displaying them.
But this is a monstrous kludge. There must surely be something wrong with
terminal emulator software (xterm, Konsole etc.) if one has to insert
10 mSec sleeps in the output process to ensure that everything gets onto
the screen. From past experiences, I expect this must be a general unix issue.
Does anyone just happen to know of a good, tidy solution to this problem?

Alan Kennington.

LinuxSA WWW: http://www.linuxsa.org.au/ IRC: #linuxsa on irc.freenode.net
To unsubscribe from the LinuxSA list:
  mail linuxsa-request at linuxsa.org.au with "unsubscribe" as the subject

More information about the linuxsa mailing list