C stdio ftell() 函式
示例
顯示檔案中的當前位置
FILE *fptr;
fptr = fopen("filename.txt", "a");
int position = ftell(fptr);
printf("%d", position);
fclose(fptr);
定義和用法
ftell()
函式返回位置指示器的值。這是檔案中下一個讀寫操作將執行的位置。
ftell()
函式定義在 <stdio.h>
標頭檔案中。
語法
ftell(FILE * fptr);
引數值
引數 | 描述 |
---|---|
fptr | 必需。一個檔案指標,通常由 fopen() 函式建立。 |
技術詳情
返回 | 一個 int 值,表示位置指示器的當前值。 |
---|