#include <stdio.h>
int main(int argc, char *argv[])
{
FILE *fp;
long length = 0;
if((fp = fopen("test.txt", "r")) == NULL)
{
perror("fopen");
return -1;
}
fseek(fp, 0, SEEK_END);
length = ftell(fp);
printf("length is %ld\n", length);
return 0;
}
测试结果
