PDA

Click to See Complete Forum and Search --> : Am I your Size??


billrogers
Aug 3rd, 2000, 09:29 AM
Anyone know how to in c determine the size of a file in bits? or bytes?

billrogers
Aug 3rd, 2000, 09:32 AM
Nevermind, have it figured, just got to use stat...

Njoannides
Aug 15th, 2000, 01:15 PM
follow this code

long fsize(char * filename)
{
FILE *fp;
long lSize;
char c;

fp = fopen(filename, "r");

for(lSize = 0;(c = fgetc(fp)) != EOF; lSize++)
;

fclose(fp);
return ( lSize );
}

billrogers
Aug 15th, 2000, 03:55 PM
could also use

_filelength(handle of file)

this will return the number of bytes the file is.