RICK@ll.arpa (06/20/88)
Local Cc: RICK Message-ID: <RICK.17243274@LL.ARPA> Subject: Re: Stdio (stderr) buffering question A related but different question on studio buffering in conjunction with pipe/fork/dup/exec sequence. I recently built a simple parent/child process pair with the parent communicating with user via stdio and communicating with the child via pipes (one for reading another for writing). The child first reconnected pipe tips to stdio then exec'd a simple program which did a looping cat(1) -- ie. prompt the user for a filename read/write the file to stdout until filename == quit This loopcat program was written in both C and Fortran. The parent/child pair ran as expected when the C version of loopcat was exec'd and hung when the Fortran version was exec'd. Addition of flush(3f) (available on SUN) after each write to stdout in loopcat.f made the Fortran version work. Obviously there's some studio buffering inconsistancy between C and Fortran but I find no explanation of it in any of the documentation for systems I have access to. This condition exists on: Sun 3 series hardware running SunOS 3.4 and 3.5 Sun 4 series hardware running SunOS 3.2 SGI IRIS 4D running System V Release 3.2 However, SGI IRIS 3130 and 2400T machines running GL2-W3.6 does not exhibit the problem -- both the C and Fortran versions of loopcat work. In all cases the compilers used are the ones supplied by the machine vendor. Any ideas? regards Rick Lloyd MIT Lincoln Lab