filelength() Return File Length
#include <io.h> Required for declarations only
long filelength(handle);
int handle; Handle referring to open file
filelength() returns the length, in bytes, of the file associated
with 'handle'.
Returns: The file length in bytes if successful, or -1L if the
file handle is invalid.
-------------------------------- Example ---------------------------------
The following statements open a file and find its length.
#include <io.h>
#include <stdio.h>
#include <stdlib.h>
FILE *in;
int length;
main()
{
in = fopen("invoice.dat","r");
.
.
length = filelength(fileno(in));
}
Seealso:
This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster