<tt>int fclose(FILE *stream)</tt>




Document: The C Standard Library

next void perror(char *s)
up Input and Output: stdio.h
gif int scanf(char *format...)

int fclose(FILE *stream)

fclose() simply closes the open file associated with stream. The return value is zero if this is completed successfully; otherwise it is EOF and errno is set.

While open files should be closed automatically if or when your program exits anyway, it is still a good practice to explicitly close files with fclose() when your program is finished with them. This makes the behaviour of the program more intelligible to someone reading it, and also provides a little extra "robustness" against the possibility that your program might terminate abnormally (i.e. CRASH!).



McMullin@eeng.dcu.ie
Fri Mar 29 14:35:38 GMT 1996