fopen

Full prototype:

FILE* fopen(const char* restrict, const char* restrict);  

Purpose and Notes:

Opens a file and returns a file pointer for the file path (relative or absolute) passed in as the first argument. It opens the file in a specific mode such as read only, write only, truncate, binary or text as well as a more and a mix of them. This is discussed further in FILE OPERATIONS.

Returns:

FILE*- Returns a file pointer for the file passed in as its first argument or returns NULL if there was an error opening the file.

Argument 1:

const char* restrict- A string that contains either the relative or absolute path to a file that you want to open.

Argument 2:

const char* restrict- A string that contains one of the options listed in the FILE OPERATIONS. These determine both what actions can be done on the file, but also controls things like where in the file you start at.

Example 1