<<<<<<<<<<<<<<<<<

pipe(unix) Unix pipe(unix)

NAME

pipe - A unidirectional file stream with read and write access capability

DESCRIPTION

The pipe object is an interface to unix pipes. When a pipe is opened, two file descriptors are created, one for reading and one for writing. Data written to the write-end of the pipe will be available for reading from the read-end of the pipe. The pipe can be accessed either by file descriptor (for unix calls) or by file pointer (for C standard I/O library calls.

SUPERCLASS

object

INSTANCE VARIABLES

No user-settable instance variables.

MESSAGES

open! Creates a pipe with read and write file descriptors. Also opens C file streams that access those underlying descriptors.

close! Closes the read and write ends of the pipe.

close_write! Closes only the write-end of the pipe. When this occurs, the read-end will be ready for reading (as indicated by select(2)) and a read on the read-end will return EOF. There is no corresponding "close_read!" message, since an attept to write to the write-end after the read-end is closed will generate a SIGPIPE signal.

read_fd? Returns the integer file descriptor for the read- end of an opened pipe, or -1 if the pipe is not open.

write_fd? Returns the integer file descriptor for the write- end of an opened pipe, or -1 if the write-end is not open.

read_file? Returns a (FILE *) pointer corresponding to the file stream attached to the read-end of the pipe, or NULL if the pipe is not open.

write_file? Returns a (FILE *) pointer corresponding to the file stream attached to the write-end of the pipe, or NULL if the write-end is not open.

write:<arguments> Takes an arbitrary number of arguments of type float, integer, or string, and writes them (after converting the numeric arguments to string form) to the write end of the pipe, followed by a newline character.

EXAMPLE

SEE ALSO

parser, io_select


Please send comments and suggestions to
consult@rpi.edu