#include <stdio.h> FILE *fopen(const char *filename, const char *mode);
This function opens a stream corresponding to the named filename with the given mode. The mode can be one of the following:
r
w
a
Followed by any of these characters:
b
fopen
will
disable the generation of SIGINT
when you press Ctrl-C
(Ctrl-Break will still cause SIGINT
), because many programs
that use binary reads from the console will also want to get the
`^C' characters. You can use the __djgpp_set_ctrl_c
library
function (see section __djgpp_set_ctrl_c) if you want Ctrl-C to
generate interrupts while console is read in binary mode.
t
+
O_RDWR
so that both reads and writes
can be done to the same file.
If the file is open for both reading and writing, you must call
fflush
, fseek
, or rewind
before switching from read
to write or from write to read.
The open file is set to line buffered if the underlying object is a device (stdin, stdout, etc), or is fully buffered if the underlying object is a disk file (data.c, etc).
If b
or t
is not specified in mode, the file type is
chosen by the value of fmode
(see section _fmode).
If you need to specify the DOS share flags use the __djgpp_share_flags
.
See section __djgpp_share_flags.
A pointer to the FILE
object, or NULL
if there was an
error.
ANSI, POSIX
FILE *f = fopen("foo", "rb+"); /* open existing file for read/write, binary mode */
Go to the first, previous, next, last section, table of contents.