Path: utzoo!attcan!uunet!virtech!cpcahil From: cpcahil@virtech.uucp (Conor P. Cahill) Newsgroups: comp.unix.questions Subject: Re: Question on printf() Message-ID: <1990Jun15.120003.25175@virtech.uucp> Date: 15 Jun 90 12:00:03 GMT References: <24674.266e3b81@kuhub.cc.ukans.edu> <1990Jun8.030206.4532@virtech.uucp> <1990Jun15.042610.18292@dasys1.uucp> Reply-To: cpcahil@virtech.UUCP (Conor P. Cahill) Organization: Virtual Technologies Inc., Sterling VA Lines: 25 In article <1990Jun15.042610.18292@dasys1.uucp> jpr@dasys1.UUCP (Jean-Pierre Radley) writes: >In article <1990Jun8.030206.4532@virtech.uucp> cpcahil@virtech.UUCP (Conor P. Cahill) writes: >> [as one of the ways to geta printf() call to show up right away] > >>3. add a setbuf(stdout,(char *) 0) at the begining of your program. This >>turns off all output buffering and can have a detrimental effect on the >>overall performance of your software. > >Why is that? Because it causes all output be be written immediatly. If you are using something like curses for a full screen program it noticably slows down the screen drawing. (Enough that an end-user will notice and complain about it). Normally output is not written to stdout (that is associated with a tty) until a newline is sent. When stdout is redirected to a file, it is buffered for a full stdio block. Using setbuf() turns off all buffering. -- Conor P. Cahill (703)430-9247 Virtual Technologies, Inc., uunet!virtech!cpcahil 46030 Manekin Plaza, Suite 160 Sterling, VA 22170