r or rb
Open file for reading.
w or wb
Truncate to zero length or create file for writing.
a or ab
Append; open or create file for writing at end-of-file.
r+ or rb+ or r+b
Open file for update (reading and writing).
w+ or wb+ or w+b
Truncate to zero length or create file for update.
a+ or ab+ or a+b
Append; open or create file for update, writing at end-of-file.

open or createThe character 'b' shall have no effect, but is allowed for ISO C standard conformance

rb Open a binary file for reading. The file which is specified in the
fopen() must be exist. wb Create an empty binary file for writing. If the file exists, file contents will be cleared unless it is a logical file. ab Open a binary file in append mode for writing at the end of the file. If file is doesn't exist fopen() function will create the file. r+b or rb+ Open a binary file for both reading and writing. The file must be exist. w+b or wb+ Create an empty binary file for both reading and writing. If the file exists, file contents will be cleared unless it is a logical file. a+b or ab+ Open a binary file in append mode for writing at the end of the file. If file is does not exist fopen() function will create the file.