in reply to Communicating with unflushed child process

If you control the subprogram, you could just flush the output after each write.

The reason ls works is that it prints its output (buffered, like myProgram), but then exits, which flushes the buffer. If you were to run "perl -p -e s/cat/dog/' you would have the same buffering problems.

Also, you should never use "gets()", since there's no way to stop it from writing past the 32rd byte of b[], which will kick your dog and steal your wife.

  • Comment on Re: Communicating with unflushed child process