cplusplus.com > reference > cstdio > fclose
fclose
<stdio.h>
  cplusplus.com  
int  fclose (FILE * stream);

Close a stream.
  Close the file associated with the specified stream after flushing all buffers associated with it.

Parameter.

stream
Pointer to FILE structure specifying the stream to be closed.

Return Value.
  If the stream is successfully closed 0 is returned. If any error EOF is returned.

Example.

/* fclose example */
#include <stdio.h>
int main ()
{
  FILE * pFile;
  pFile = fopen ("myfile.txt","wt");
  fprintf (pFile, "fclose example");
  fclose (pFile);
  return 0;
}

See also.
  fopen, freopen, fflush


© The C++ Resources Network, 2000