How do you determine the size of a file in C?

前端 未结 14 940
野性不改
野性不改 2020-11-22 03:20

How can I figure out the size of a file, in bytes?

#include 

unsigned int fsize(char* file){
  //what goes here?
}
14条回答
  •  孤独总比滥情好
    2020-11-22 03:52

    Looking at the question, ftell can easily get the number of bytes.

      long size = ftell(FILENAME);
      printf("total size is %ld bytes",size);
    

提交回复
热议问题