totn C Functions

C Language: fopen function
(Open File)

In the C Programming Language, the fopen function opens a file called filename and associates it to stream. The fopen function clears all error and EOF indictors for the stream.

Syntax

The syntax for the fopen function in the C Language is:

FILE *fopen(const char *filename, const char *mode);

Parameters or Arguments

filename
The filename to associate with the new file being opened.
mode
The mode in which to open the file.

Returns

The fopen function returns a file pointer for the new file. If a new file can not be opened, the fopen function returns a null pointer.

Required Header

In the C Language, the required header for the fopen function is:

#include <stdio.h>

Applies To

In the C Language, the fopen function can be used in the following versions:

  • ANSI/ISO 9899-1990

Similar Functions

Other C functions that are similar to the fopen function:

See Also

Other C functions that are noteworthy when dealing with the fopen function: