LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   pipeline buffering (https://www.linuxquestions.org/questions/linux-software-2/pipeline-buffering-267190/)

jk3us 12-16-2004 05:41 PM

pipeline buffering
 
I am having the problem of programs in a pipeline (or redirect) having their output buffered by stdio. I've seen a few people suggest that expect could be used to make the program think it's running on a pty. Can anyone give me an example of this?

jk3us 12-17-2004 09:15 AM

anyone?
 
anyone know?

rjlee 12-17-2004 07:52 PM

I don't think I quite understand the question.

If you use the low-level read(2) and write(2) system calls, then you will always get unbuffered I/O. If you use the libc functions fread(3) and fwrite(3) then you will get line-buffered I/O, at least by default. You can use setbuf() to control buffering on stdin and stdout.

expect(1) is a program that interacts with another program by reading it's standard output stream and writing to its standard input stream, buffered or not. Is this what you're wanting to do? Or are you trying to pipe a stream without buffering it?


All times are GMT -5. The time now is 07:47 AM.