Re: How to flush an output port

Mikael Djurfeldt (mdj@nada.kth.se)
07 Mar 1997 14:25:21 +0100

Glenn Moloney <glenn@micron.ph.unimelb.EDU.AU> writes:

> Sorry if this is not an appropriate post to this list, but I can't
> sort this one out.

I think it is appropriate, as we have no gnu.guile.help yet.

> I'm having a little problem with `open-output-pipe'. I've opened a
> connection to a gnuplot process via:
> (set! gnuplot-port (open-output-file "gnuplot"))
>
> I then write commands to the port using print, etc..., but the command
> line does not get flushed to the pipe. I can't find a `flush' function
> anywhere. The only solution I can think of is that I must use
> `with-output-to-file' so the pipe is the current port. Then `newline'
> will flush the port. Unfortunately this means I have to open the file
> everytime I send a command. Is there a simple alternative?

Try (force-output <port>).

Best regards,
/mdj