/* ftell example : getting size of a file */ #include <stdio.h> int main () { FILE * pFile; long size; pFile = fopen ("myfile.txt","rb"); if (pFile==NULL) perror ("Error opening file"); else { fseek (pFile, 0, SEEK_END); // non-portable size=ftell (pFile); fclose (pFile); printf ("Size of myfile.txt: %ld bytes.\n",size); } return 0; } |
fgetpos | 获取流中的当前位置(function ) |
fseek | 重新定位流位置标志器(function ) |
rewind | 将流的位置设置为开头(function ) |