popen-write

Synopsis

(popen-write command)

Parameters

  • command

Description

This procedure creates an output port by invoking popen() with the specified command (a string). The created output port is connected to STDIN of the command.

The created ouput port is closed by garbage collection is no longer referenced (by calling pclose()) or may be closed explicitely (using close-ouput-port or close).

Side Effects

Return Value

The created output port is returned.

Example

> (define port (popen-write "cat > /tmp/OUTFILE"))
port
> (print 1234 port)
ok
> (close port)
ok
> (system "cat /tmp/OUTFILE")
1234
0
>