fclose() can be used to close a stream.. How-ever please remember some facts about fclose().. When you call fclose() the buffered output is written and any buffered input is discarded.. Also its important to know the return value of fclose()..
Upon successful completion 0 is returned. Otherwise, EOF is returned and errno is set to indicate the error. In either case any further
access (including another call to fclose()) to the stream results in undefined behavior.
The function fclose is declared in stdio.h.
int fclose(FILE *fp);