Results 1 to 4 of 4

Thread: Am I your Size??

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2000
    Posts
    367
    Anyone know how to in c determine the size of a file in bits? or bytes?

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    May 2000
    Posts
    367
    Nevermind, have it figured, just got to use stat...

  3. #3
    New Member
    Join Date
    Aug 2000
    Location
    France
    Posts
    7
    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 );
    }







  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    May 2000
    Posts
    367
    could also use

    _filelength(handle of file)

    this will return the number of bytes the file is.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width