函式 ftell 使用說明

2021-08-20 08:06:46 字數 421 閱讀 5307

簡介:函式 ftell() 用於得到檔案指標當前位置相對於檔案首的偏移位元組數。

標頭檔案:#include 

原型:long ftell(file *stream);

功能:返回當前檔案位置。使用fseek函式後再呼叫函式ftell()就能非常容易地確定檔案的當前位置。

用法:ftell(fp); 利用函式 ftell() 能方便地知道乙個檔案的長。如以下語句序列: fseek(fp, 0l, seek_end); len =ftell(fp); 首先將檔案的當前位置移到檔案的末尾,然後呼叫函式ftell()獲得當前位置相對於檔案首的位移,該位移值等於檔案所含位元組數。

前提條件:因為 ftell() 返回long型,根據long型的取值範圍-2^31~2^31-1(-2147483648~2147483647),故對大於2.1g的檔案進行操作時出錯。

memset 函式使用說明

sets buffers to a specified character.void memset void dest intc size tcount example memset.c this program uses memset to set the first four bytes of ...

php header 函式使用說明

php只是以http協議將html文件的標頭送到瀏覽器,告訴瀏覽器具體怎麼處理這個頁面,至於傳送的內容則需要熟悉一下http協議了,與php無關了,可參照 header 函式使用說明 一 作用 php只是以http協議將html文件的標頭送到瀏覽器,告訴瀏覽器具體怎麼處理這個頁面,至於傳送的內容則需...

linux open 函式使用說明

open 函式用於開啟和建立檔案。以下是open 函式的簡單描述 include int open const char pathname,int oflag,返回值 成功則返回檔案描述符,否則返回 1 對於 open 函式來說,第三個引數 僅當建立新檔案時才使用,用於指定檔案的訪問許可權位 acc...