Question on printf()
Jeff Beadles;685-2568;;;quark
jeff at quark.WV.TEK.COM
Sat Jun 9 00:52:16 AEST 1990
In article <24674.266e3b81 at kuhub.cc.ukans.edu> jian at kuhub.cc.ukans.edu writes:
|Hi folks, I have one simple question about printf() on Utrix. Following is the
|program that I question about:
...
|display()
|{
| printf("\n\n\nEnter Command -> ");
Insert the line:
fflush(stdout);
| alarm(60);
|}
|
|I don't know why the printf() only prints three linefeeds and the "Enter
|Command -> " only shows up on every next call to display. It seems to me
|that if I don't do any I/O and linefeed after printf(), the printf() does
|not print the string argument on the standard output. Why? How can I avoid
|this problem? I very much appreciate any helps.
|
|Jian Li
|jian at kuhub.cc.ukans.edu
Things will work much better with the fflush. The problem is that stdio is
buffered by default, and is waiting for a \n to flush the output buffer.
-Jeff
--
Jeff Beadles jeff at quark.WV.TEK.COM
Utek Engineering, Tektronix Inc. +1 503 685 2568
SPEEA - Just say no.
More information about the Comp.unix.questions
mailing list