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>
    long int filelength( int handle );

Description:
    The filelength function returns the number of bytes in the opened file
    indicated by the file handle handle.

Returns:
    If an error occurs, (-1L) is returned.  When an error has occurred,
     errno contains a value indicating the type of error that has been
    detected.

    Otherwise, the number of bytes written to the file is returned.

Example:
    #include <sys/types.h>
    #include <fcntl.h>
    #include <stdio.h>
    #include <io.h>

    void main()
      {
        int handle;

        /* open a file for input              */
        handle = open( "file", O_RDONLY | O_TEXT );
        if( handle != -1 ) {
          printf( "Size of file is %ld bytes\n",
                  filelength( handle ) );
          close( handle );
        }
      }

    produces the following:

    Size of file is 461 bytes

Classification:
    WATCOM

Systems:
    All, Netware

See Also:
    fstat, lseek, tell

See Also: tell

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