Query: fopen
OS: minix
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
FOPEN(3) Library Functions Manual FOPEN(3)NAMEfopen, freopen, fdopen - open a streamSYNOPSIS#include <stdio.h> FILE *fopen(const char *filename, const char *type) FILE *freopen(const char *filename, const char *type, FILE *stream) FILE *fdopen(int fildes, const char *type)DESCRIPTIONFopen opens the file named by filename and associates a stream with it. Fopen returns a pointer to be used to identify the stream in sub- sequent operations. Type is a character string having one of the following values: "r" open for reading "w" create for writing "a" append: open for writing at end of file, or create for writing In addition, each type may be followed by a "+" to have the file opened for reading and writing. "r+" positions the stream at the begin- ning of the file, "w+" creates or truncates it, and "a+" positions it at the end. Both reads and writes may be used on read/write streams, with the limitation that an fseek, rewind, or reading an end-of-file must be used between a read and a write or vice-versa. Freopen substitutes the named file in place of the open stream. It returns the original value of stream. The original stream is closed. Freopen is typically used to attach the preopened constant names, stdin, stdout, stderr, to specified files. Fdopen associates a stream with a file descriptor obtained from open, dup, creat, or pipe(2). The type of the stream must agree with the mode of the open file.SEE ALSOopen(2), fclose(3).DIAGNOSTICSFopen and freopen return the pointer NULL if filename cannot be accessed, if too many files are already open, or if other resources needed cannot be allocated.BUGSFdopen is not portable to systems other than UNIX. The read/write types do not exist on all systems. Those systems without read/write modes will probably treat the type as if the "+" was not present. These are unreliable in any event. 4th Berkeley Distribution May 27, 1986 FOPEN(3)
Related Man Pages |
---|
fopen(3) - minix |
fopen(3ucb) - sunos |
freopen(3s) - bsd |
fopen(3) - osx |
fdopen(3) - osx |
Similar Topics in the Unix Linux Community |
---|
Reading a file into a C++ script |
Mac OS X - open() and fopen() with French filename |
how to recover writing stream |
how to write a file to binary format in C ? |
Error in handling stream objects |