重定位檔案指標fseek

2021-06-19 23:27:43 字數 537 閱讀 7738

用法:int  fseek( file *stram, long offset ,int  position);

描述:該函式用來設定檔案指標stream的位置。如果執行成功,stream 將以position 為基準,偏移offset 個位元組的位置。如果執行失敗,則不改變指標的位置。

position 用來設定從檔案的哪個位置開始偏移,

seek_set      從檔案開頭位置 

seek_cur    從檔案當前位置

seek_end    從檔案末尾位置

函式:long ftell(file *stream);

功能: 返回檔案當前指標位置,

函式功能:使用fseek函式後在呼叫函式ftell就能很容易確定函式當前位置

c語言中可以用fseek來定位檔案指標的位置

c語言中可以用fseek來定位檔案指標的位置 fseek fp,offset,seek set fseek fp,offset,seek cur fseek fp,offset,seek end fp為開啟的檔案指標,offset為相對偏移 seek set表示從檔案起始位置開始計算 seek cu...

檔案操作 fseek

int fseek file stream,long offset,int fromwhere fseek 用於二進位制方式開啟的檔案,移動檔案讀寫指標位置.int fseek file stream,long offset,int origin 第乙個引數stream為檔案指標 第二個引數offs...

可重定位目標檔案

目標檔案有三種形式 1.可重定位目標檔案 2.可執行目標檔案 3.共享目標檔案 編譯器和彙編器生成可重定位目標檔案 共享目標檔案,聯結器生成可執行目標檔案。在這裡我們首先介紹可重定位目標檔案。可重定位目標檔案 包含二進位制 和資料,可以在編譯時與其他可重定位目標檔案合併起來,建立乙個可執行目標檔案。...