PSIO(3) — C LIBRARY FUNCTIONS
NAME
psio − NeWS buffered input/output package
SYNOPSIS
#include "psio.h"
PSFILE ∗psio_stdin;
PSFILE ∗psio_stdout;
PSFILE ∗psio_stderr;
DESCRIPTION
The functions described here constitute a user-level I/O buffering scheme for use when communicating with NeWS. This package is based on the standard I/O package that comes with Unix. The functions in this package are used in the same way as the similarly named functions in Standard I/O.
The in-line macros psio_getc and psio_putc handle characters quickly. The higher level routines psio_read, psio_printf, psio_fprintf, psio_write all use or act as if they use psio_getc and psio_putc; they can be freely intermixed.
A file with associated buffering is called a stream, and is declared to be a pointer to a defined type PSFILE. psio_open creates certain descriptive data for a stream and returns a pointer to designate the stream in all further transactions. Normally, there are three open streams with constant pointers declared in the psio.h include file and associated with the standard open files:
psio_stdin
standard input file
psio_stdout
standard output file
psio_stderr
standard error file
A constant NULL (0) designates a nonexistent pointer.
An integer constant EOF (−1) is returned upon end-of-file or error by most integer functions that deal with streams.
Any module that uses this package must include the header file of pertinent macro definitions, as follows:
#include "psio.h"
The functions and constants mentioned in here are declared in that header file and need no further declaration. The constants and the following ‘functions’ are implemented as macros; redeclaration of these names is perilous: getc, putc, psio_eof, psio_error, psio_fileno, and psio_clearerr.
SEE ALSO
open(2V), close(2), read(2V), write(2V), intro(3S), fclose(3S), ferror(3S), fopen(3S), fread(3S), getc(3S), printf(3S), putc(3S), ungetc(3S).
DIAGNOSTICS
The value EOF is returned uniformly to indicate that a PSFILE pointer has not been initialized with psio_open, input (output) has been attempted on an output (input) stream, or a PSFILE pointer designates corrupt or otherwise unintelligible PSFILE data.
LIST OF FUNCTIONS
NameDescription
psio_clearerrstream status inquiries
psio_closeflush a stream
psio_eofstream status inquiries
psio_errorstream status inquiries
psio_fdopenopen a stream
psio_flushclose or flush a stream
psio_filenostream status inquiries
psio_fprintfformatted output conversion
psio_getcget character or integer from stream
psio_openopen a stream
psio_readbuffered binary input/output
psio_printfformatted output conversion
psio_putcput character or word on a stream
psio_ungetcpush character back into input stream
psio_writebuffered binary input/output
Sun Release 4.0 — Last change: 9 November 1987