Opening Modes in Standard I/O

File Mode

Meaning of Mode During Inexistence of file
r Open for reading. If the file does not exist, fopen() returns NULL.
rb Open for reading in binary mode. If the file does not exist, fopen() returns NULL.
w Open for writing. If the file exists, its contents are overwritten. If the file does not exist, it will be created.
wb Open for writing in binary mode. If the file exists, its contents are overwritten. If the file does not exist, it will be created.
a Open for append. i.e, Data is added to end of file. If the file does not exists, it will be created.
ab Open for append in binary mode. i.e, Data is added to end of file. If the file does not exists, it will be created.
r+ Open for both reading and writing. If the file does not exist, fopen() returns NULL.
rb+ Open for both reading and writing in binary mode. If the file does not exist, fopen() returns NULL.
w+ Open for both reading and writing. If the file exists, its contents are overwritten. If the file does not exist, it will be created.
wb+ Open for both reading and writing in binary mode. If the file exists, its contents are overwritten. If the file does not exist, it will be created.
a+ Open for both reading and appending. If the file does not exists, it will be created.
ab+ Open for both reading and appending in binary mode. If the file does not exists, it will be created.

Comments

Post a Comment

Popular posts from this blog

Area and Perimeter of circle program in c

Apply a motion path to text or an object

IP address