2016年5月4日 星期三

C fread方法及計算file size



size_t fread ( void * ptr, size_t size, size_t count, FILE * stream );

由檔案系統讀出一串資料,明確講是由檔案系統指標 stream 讀出 count 的 size bytes 的 array, fread ( ) 讀出後會自動地將檔案系統指標 stream 增加 count*size bytes 為新指標位置;

獲得File size方式


long lSize;
// obtain file size: fseek (pFile , 0 , SEEK_END); lSize = ftell (pFile); rewind (pFile);


參考:

http://knowledge-teaching.blogspot.tw/2012/11/c-fread-fget.html

沒有留言:

張貼留言