delorie.com/djgpp/doc/libc/libc_525.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

lfilelength

Syntax

 
#include <io.h>

long long lfilelength(int fhandle);

Description

This function returns the size, in bytes, of a file whose handle is specified in the argument fhandle. To get the handle of a file opened by fopen (see section fopen) or freopen (see section freopen), you can use fileno macro (see section fileno).

Return Value

The size of the file in bytes, or (if any error occured) -1LL and errno set to a value describing the cause of the failure.

The return value is of type long long which allows file sizes of 2^63-1 bytes to be returned. Note that FAT16 limits files to near 2^31 bytes and FAT32 limits files to 2^32-2 bytes.

Portability

ANSI/ISO C No
POSIX No

Example

 
  printf("Size of file to which STDIN is redirected is %ld\n", 
          lfilelength(0));


  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004