Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ filelength(DOS) — Xenix 2.3.4g

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chsize(S)

ferror(S)

stat(S)



     FILELENGTH(DOS)          XENIX System V           FILELENGTH(DOS)



     Name
          filelength - Gets the length of a file.

     Syntax
          #include <io.h>

          long filelength (handle);
          int handle;

     Description
          The filelength function returns the length in bytes of the
          file associated with the given handle.

     Return Value
          filelength returns the file length in bytes.  A return value
          of -1L indicates an error, and errno is set to EBADF to
          indicate an invalid file handle.
     See Also
          chsize(S), ferror(S), stat(S)

     Example
          #include <io.h> #include <stdio.h> #include <stdlib.h>

          FILE *stream; long length;

          stream = fopen ("data","r");
            .
            .
            .  /* The following statements attempt to determine the **
          length of a file associated with a stream.  */

          length = filelength (fileno (stream));

          if (length == -1L)      perror ("filelength failed");

     Notes
          This call must be compiled with the -dos flag.


















     Page 1                                           (printed 8/7/87)



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026