fopen, freopen \- open a stream
.B *fopen(filename, type)
.B char *filename, *type;
.B *freopen(filename, type, stream)
.B char *filename, *type;
and associates a stream with it.
returns a pointer to be used to identify
the stream in subsequent operations.
is a character string having one of the following values:
Create for concurrent read/write access.
The file is first truncated, if it exists,
and created if it does not.
Append: open for writing at end
of file, or create for writing
Read and append: open for concurrent read/write access at end
of file, or create file and open with such access
Read and write: open for both reading and writing
but do not truncate the file first.
substitutes the named file in place
It returns the original value of
The original stream is closed.
is typically used to attach the preopened
.B stdin, stdout, stderr,
The "+" syntax is included merely for compatibility with the USG
stdio, and is not to be viewed as true support.
The USG stdio has restrictions on how you can switch from reading
to writing or vice versa.
LibNS has no such restrictions, at a small runtime cost.