C stdio ftell() 函数
定义和用法
ftell()
函数返回位置指示器的值。这个位置是文件中进行下一次读或写操作的位置。
ftell()
函数定义在 <stdio.h>
头文件中。
实例
显示文件中的当前位置:
FILE *fptr; fptr = fopen("filename.txt", "a"); int position = ftell(fptr); printf("%d", position); fclose(fptr);
语法
ftell(FILE * fptr);
参数
参数 | 描述 |
---|---|
fptr | 必需。文件指针,通常由 fopen() 函数创建。 |
技术细节
返回: | int 值,表示位置指示器的当前值。 |
---|