ProAnswers.org

How is fopen()used ?

The function fopen() returns a file pointer. Hence a file pointer is declared and it is assigned

as

FILE *fp;

fp= fopen(filename,mode);

filename is a string representing the name of the file and the mode represents:

“r” for read operation

“w” for write operation

“a” for append operation

“r+”,”w+”,”a+” for update operation