fopen()

The fopen() function is used for opening a file for reading, writing, and doing other operations. Here is its syntax:

FILE *fopen (const char *file_name, const char *mode)

Here, file_name represents the file that we want to work on and mode states the purpose for which we want to open the file. It can be any of the following:

The fopen function returns a file descriptor that points to the file for performing different operations.