fclose() Close a Stream
#include <stdio.h>
int fclose(stream);
FILE *stream; Pointer to file structure
fclose() closes 'stream'. All buffers associated with 'stream' are
flushed before being closed. System-allocated buffers are freed when
the stream is closed.
Returns: Zero if the stream is successfully closed. EOF is
returned on error.
Notes: Use fclose() to close a file that has been opened with
fopen(). Buffers assigned using setbuf() are not
automatically freed.
-------------------------------- Example ---------------------------------
The following statements open and close a file.
#include <stdio.h>
FILE *in;
main()
{
if ((in = fopen("input.dat","r+"))!= NULL) {
.
.
.
fclose(in);
}
}
Seealso:
This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster