C语言快速获取文件的大小的两种方法: 1. long int size; FILE *fp; fp=fopen("file","rb"); fseek(fp,0,SEEK_END); size=ftell(fp); flcose(fp); 2. int fd,size; struct stat buf; fd=open("file",O_RDONLY); fstat(fd,&buf); size=buf.st_size;