The function fclose () in C
Int fclose function (FILE * stream) in Library C closes Stream. All buffers are flushed (erased or moved to the periphery).
Int fclose function (FILE * stream) in Library C closes Stream. All buffers are flushed (erased or moved to the periphery).
Declare the function fclose () in C
Here is the declaration for fclose () function in C:
int fclose ( FILE * stream )
Parameters
stream - This is the pointer to the FILE object that identifies Stream to be closed.
Returns the value
This method returns 0 if Stream is successfully closed. If failure, EOF is returned.
For example
The following program C illustrates the usage of the fclose () function in C:
#include int main () { FILE * fp ; fp = fopen ( "baitapc.txt" , "w" ); fprintf ( fp , "%s" , "Hoc C co ban va nang cao tai QTM !!!" ); fclose ( fp ); return ( 0 ); }
Compiling and running the above C program will create a bait.txt file , and then it will write the following text line and eventually it will close this file using the fclose () function. And see the results.
According to Tutorialspoint
Last lesson: stdio.h in C
Next lesson: Function clearerr () in C
You should read it
Maybe you are interested
Admire the colorful moment of a star in the making The whole scene of meteorites hitting the Earth during the past 33 years, why can't we feel it? The most beautiful meteor shower of the year and amazing astronomical phenomena in August Is Proxima b our 'neighbor' planet? Why have scientists found Proxima b - '2nd Earth' until now? The mystery of the numbers of Proxima b: The 'Second Earth' on the planet may exist life