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

前端 未结 14 1174
野性不改
野性不改 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 04:03

    And if you're building a Windows app, use the GetFileSizeEx API as CRT file I/O is messy, especially for determining file length, due to peculiarities in file representations on different systems ;)

提交回复
热议问题