From: Petr M. <mi...@ph...> - 2004-02-18 17:03:32
|
> > Well, ad to the above problem with fifo in Octave -- why the following in > > bash does not work? > > > > bash$ mkfifo cau > > bash$ tail -f cau > > > > and in another xterm: > > > > gnuplot> set print "cau" > > gnuplot> print "hello" > > > > Only sometimes the text appears in the "tail", but always it gets flushed > > after "set print" (closing print file) or quitting gnuplot -- and why it > > works in the C demo without closing "set print"? > > This may well be a problem of buffering. FIFOs are fully buffered by > default, I think, whereas stderr, the default 'set print' output channel, > is always completely unbuffered by C standard requirements. I.e. it > should help to explicitly setbuf() the channel 'set print' opened to > unbuffered. I've tried to put setvbuf(print_out, (char *) NULL, _IONBF, 0); into print_command(), but it does not help either. Also, when restarting gnuplot for the 2nd time and go to print to "cau", then tail -f will not show the new text any longer. --- Petr Mikulik |