Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <io.h>
    int eof( int handle );

Description:
    The eof function determines, at the operating system level, if the end
    of the file has been reached for the file whose file handle is given by
    handle.  Because the current file position is set following an input
    operation, the eof function may be called to detect the end of the file
    before an input operation beyond the end of the file is attempted.

Returns:
    The eof function returns 1 if the current file position is at the end of
    the file, 0 if the current file position is not at the end.  A return
    value of -1 indicates an error, and in this case  errno is set to
    indicate the error.

Errors:
    When an error has occurred,  errno contains a value indicating the type
    of error that has been detected.

    EBADF
        The handle argument is not a valid file handle.


Example:
    #include <stdio.h>
    #include <fcntl.h>
    #include <io.h>

    void main()
      {
        int handle, len;
        char buffer[100];

        handle = open( "file", O_RDONLY );
        if( handle != -1 ) {
          while( ! eof( handle ) ) {
            len = read( handle, buffer, sizeof(buffer) - 1 );
            buffer[ len ] = '\0';
            printf( "%s", buffer );
          }
          close( handle );
        }
      }

Classification:
    WATCOM

Systems:
    All, Netware

See Also:
    read

See Also: read

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