[Maxima] writing into and reading from fifos

Robert Dodier robert.dodier at gmail.com
Sat Sep 15 11:00:19 CDT 2007


On 9/14/07, Fabrizio Caruso <caruso at dm.unipi.it> wrote:

> I would like to read and write strings into such files.
>
> I can open for writing a file as a stream by
> "f : openr(<path>)"
>
> I can read it by
> "readline(f)"
>
> but I don't know how to append/write data into this file.

Fabrizio, some other ideas in addition to what other people have told you.

The Lisp function MREAD is called by the Maxima parser to get
the next input expression. MREAD accepts a stream as an argument.
So you could call it from your Maxima program as ?mread(s) where s
is your input stream. MREAD returns an expression with
operator = 'displayinput; second(?mread(s)) returns the input
expression proper.

The functions read_list, read_matrix, etc. (in the numericalio
package) now accept an input stream as an argument, as well
as a file name. write_data accepts an output stream as an argument.

with_stdout(s, ...) writes any output generated by ... to the stream s.

Hope this helps, & good luck.

Robert


More information about the Maxima mailing list