C Language: fclose function(Close File)

In the C Programming Language, the fclose function closes a stream pointed to by stream. The fclose function flushes any unwritten data in the stream's buffer.


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

int fclose(FILE *stream);

Parameters or Arguments


The stream to close.


The fclose function returns zero if successful or EOF if an error was encountered.

Required Header

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

#include <stdio.h>

Applies To

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

  • ANSI/ISO 9899-1990

stdio.h Functions