[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
octave > FIFO
From: |
Ted Harding |
Subject: |
octave > FIFO |
Date: |
Sun, 25 May 1997 13:54:23 +0100 (GMT+0100) |
Hi Folks,
I want to write from octave to a FIFO (named pipe). What is the best way
to do this? It doesn't seem to be straightforward.
Non-octave example:
-------------------
mkfifo temp
Now go to another window (but the same directory) and execute
cat < temp
Back in to first window, execute
cat > temp
line 1
line 2
^D
(terminating with Ctrl-D). The lines typed in on screen 1 will be
displayed on screen 2 after their newlines are entered.
Having closed the stream with ^D, you can start a new stream in the same
way, from the same or a different wndow (the FIFO remains in place).
Otave example:
--------------
In the directory octave is running in, do
mkfifo temp
Now fprintf("temp",FORMAT, args) looks tempting, but octave says
error: fprintf: invalid file type
However, the line
system("echo STUFF > temp")
works just fine. The only thing is, you don't want to send anything
complicated this way. It would be nice to have the formatting flexibility
of fprintf.
Any good suggestions?
The real reason I'm looking into this is not to do anything so naive as
the above examples.
Once some FIFOs have been created, other programs can read from them at
will, moving from one to another if need be. Octave can similarly write
different streams of output, line by line, to them. This offers a very
flexible interface between octave and a suite of external programs.
Who knows? It may even have something to do with recent discussions.
Bes wishes to all,
Ted. (address@hidden)
- octave > FIFO,
Ted Harding <=