Everything

fopen


Opens a stream input/output file under the specified file name.

[Format]

#include <stdio.h>

FILE *fopen (const char *fname, const char *mode);

[Parameters]

fname Pointer to string indicating file name

mode Pointer to string indicating file access mode

[Return values]

Normal: File pointer indicating file information on opened file

Abnormal: NULL

[Remarks]

The fopen function opens the stream input/output file whose file name is the string pointed to by fname. If a file that does not exist is opened in write mode or append mode, a new file is created wherever possible. When an existing file is opened in write mode, writing processing is performed from the beginning of the file, and previously written file contents are erased.

When a file is opened in append mode, write processing is performed from the end-of-file position. When a file is opened in update mode, both input and output processing can be performed on the file. However, input cannot directly follow output without intervening execution of the fflush, fseek, or rewind function. Similarly, output cannot directly follow input without intervening execution of the fflush, fseek, or rewind function.

A string indicating the opening method may be added after the string indicating the file access mode.