HELPLIB.HLB  —  CRTL  fclose
    Closes a file by flushing any buffers associated with the file
    control block and freeing the file control block and buffers
    previously associated with the file pointer.

    Format

      #include  <stdio.h>

      int fclose  (FILE *file_ptr);

1  –  Argument

 file_ptr

    A pointer to the file to be closed.

2  –  Description

    When a program terminates normally, the fclose function is
    automatically called for all open files.

    The fclose function tries to write buffered data by using an
    implicit call to fflush.

    If the write fails (because the disk is full or the user's quota
    is exceeded, for example), fclose continues executing. It closes
    the OpenVMS channel, deallocates any buffers, and releases the
    memory associated with the file descriptor (or FILE pointer). Any
    buffered data is lost, and the file descriptor (or FILE pointer)
    no longer refers to the file.

    If your program needs to recover from errors when flushing
    buffered data, it should make an explicit call to fsync (or
    fflush) before calling fclose.

3  –  Return Values

    0                  Indicates success.
    EOF                Indicates that the file control block is not
                       associated with an open file.
Close Help