Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.mel.connect.com.au!munnari.OZ.AU!news.ecn.uoknor.edu!news.wildstar.net!news.sdsmt.edu!tau.uac.net!uhog.mit.edu!news.mathworks.com!fu-berlin.de!zrz.TU-Berlin.DE!zib-berlin.de!news.tu-chemnitz.de!irz401!uriah.heep!news From: j@uriah.heep.sax.de (J Wunsch) Newsgroups: comp.unix.bsd.freebsd.misc Subject: Re: PIPE HELP!!!! Date: 14 May 1996 23:32:15 GMT Organization: Private BSD site, Dresden Lines: 24 Message-ID: <4nb55v$20d@uriah.heep.sax.de> References: <4n92oj$rho@monet.npi.msu.su> Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) NNTP-Posting-Host: localhost.heep.sax.de Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Newsreader: knews 0.9.6 X-Phone: +49-351-2012 669 X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F 93 21 E0 7D F9 12 D6 4E max@gw.mics.msu.su (Maxim V. Drogajtcev) wrote: > I have: > 1. one programm. it's display some info (into stdout) every 2 sec. > 2. second progamm. it's read from stdout and send it to other comp. stdin (i guess) Most likely, your problem is that the stdio library works line- buffered on output if the output goes to a terminal, but switches to fully-buffered for a non-terminal output stream. (Exception: stderr, which is always unbuffered.) So once you pipe the output of one program into another one, its output will become fully-buffered, and the rather large buffer will only be flushed once it has filled (which can, depending on your application, take up to several hours). You can override this in the program #1 by using setvbuf(). Refer to the man page about its usage. -- cheers, J"org joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-)