Name
fopen function — Opens a file
Synopsis
FILE* fopen(const char* filename, const char* mode)
The fopen
function opens a
file.
The filename
parameter
specifies the filename in an implementation-defined manner. The
mode
parameter specifies how to
open the file. The mode
must
begin with one of the strings listed in Table 13-4. Additional
characters can follow, and the interpretation of the extra
characters is implementation-defined. Mode strings are
case-sensitive.
Mode string | Description |
| Append: opens an existing file for appending,
that is, every write is forced to the end of the file. If
the file to be opened does not exist, |
| Read: opens an existing file for reading. |
| Write: creates a new file for writing. If the
file already exists, |
| Append in binary mode. |
| Read in binary mode. |
| Write in binary mode. |
| Append update: opens a file in append mode and allows it to be read. |
| Read update: opens an existing file for reading, and also allows writing. |
| Write update: creates a new file for writing,
and also allows reading. If the file already exists,
|
| Append update in binary mode. |
| Read update in binary mode. |
| Write update in binary mode. |
See Also
Get C++ In a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.