Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>fclose() close a stream</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 fclose()                Close a Stream


 #include   <stdio.h>

 int        fclose(stream);
 FILE       *stream;                     Pointer to FILE structure

    fclose() flushes all buffers associated with 'stream', frees all
    buffers allocated by the system, and closes 'stream'.
    Temporary files open with tmpfile() are deleted when fclose() is used
    with them.

    Returns:    0, if success; EOF on error.

      Notes:    Use fclose() to close a file that has been opened with
                fopen(). Buffers assigned with setbuf() and setvbuf() 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);
               }
           }


See Also: close() fdopen() fflush() fopen() freopen()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson