计算文件大小(C/C++语言)

 1 #include <stdio.h>
 2  
 3 int main()
 4 {
 5     FILE* fp;
 6     if (fp = fopen("read files.exe", "r"))
 7     {
 8         fseek(fp, 0,  SEEK_END);//SEEK_END :end of file
 9         printf("%.1f KB\n", 1.*ftell(fp)/1024);
10         fclose(fp);
11     }
12     return 0;
13 }

 

posted on 2013-11-11 21:21  圣手摘星  阅读(377)  评论(0编辑  收藏  举报

导航