fopen

fopen(filename,mode) returns an opened file corresponding to filename with permissions defined in mode argument.

Possible values for mode parameter are:
'r' - read mode: the file must exist.
'w' - write mode: creates an empty file. If file already exists, it will be overwritten.
'a' - append mode: write data at the end of the file, expanding it.
'r+' - read/write mode: the file must exist and its data will not be overwritten.
'w+' - read/write mode: creates an empty file. If file already exists, it will be overwritten.
'a+' - read/append mode: write data at the end of the file, expanding it.

Resources

See also

fclose | fprintf