Path: utzoo!attcan!uunet!zephyr.ens.tek.com!orca.wv.tek.com!quark!jeff From: jeff@quark.WV.TEK.COM (Jeff Beadles;685-2568;;;quark) Newsgroups: comp.unix.questions Subject: Re: Question on printf() Message-ID: <7369@orca.wv.tek.com> Date: 8 Jun 90 14:52:16 GMT References: <24674.266e3b81@kuhub.cc.ukans.edu> Sender: nobody@orca.wv.tek.com Reply-To: jeff@quark.WV.TEK.COM (Jeff Beadles) Organization: Tektronix, Inc., Wilsonville, OR Lines: 36 In article <24674.266e3b81@kuhub.cc.ukans.edu> jian@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@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@quark.WV.TEK.COM Utek Engineering, Tektronix Inc. +1 503 685 2568 SPEEA - Just say no.