Hi,
Following explanations for fopen() function different modes.

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.