Opens a file and associates a stream with it.
#include <stdio.h> FILE *fopen ( const char *filename, const char *mode);
(IN) Points to a string specifying the pathname of the file to be opened.
(IN) Points to a string specifying the file open mode. See Standard File Open Modes.
If successful, returns a pointer to the object controlling the stream. This pointer must be passed as a parameter to subsequent functions for performing operations on the file.
If the open operation fails, fopen returns a NULL pointer and sets errno to one of the following:
The fopen function opens the file whose name is the string pointed to by filename, and associates a stream with it.
Opening a file with read mode (r as the first character in the mode parameter) fails if the file does not exist or if it cannot be read. Opening a file with append mode (a as the first character in the mode parameter) causes all subsequent writes to the file to be forced to the current end-of-file, regardless of previous calls to the fseek function. When a file is opened with update mode (+ as the second or third character of the mode parameter), both input and output can be performed on the associated stream.