获取文件指针的位置。
long _tell(
   int handle
);
__int64 _telli64(
   int handle 
);
参数
- handle
引用打开文件的描述符。 
返回值
文件指针的当前位置。在计算机上各组件之间无法找到,则返回值是未定义的。
返回值 – 1L 指示错误。如果 handle 是无效的文件描述符,无效参数调用处理程序,如 参数验证所述。如果执行允许继续,对 EBADF 的这些功能集 errno 和返回 -1L。
请参见 _doserrno、 errno、 _sys_errlist 和 _sys_nerr 有关这方面的更多信息以及其他,返回代码。
备注
_tell 函数获取文件指针的当前位置 (如果有) 与 handle 参数。视区表示为字节数与最初文件。对于 _telli64 功能,此值表示为一个 64 位整数。
要求
实例  | 
必需的头  | 
|---|---|
_tell, _telli64  | 
io.h  | 
有关其他的兼容性信息,请参见中介绍的 兼容性 。
示例
// crt_tell.c
// This program uses _tell to tell the
// file pointer position after a file read.
//
#include <io.h>
#include <stdio.h>
#include <fcntl.h>
#include <share.h>
#include <string.h>
int main( void )
{
   int  fh;
   char buffer[500];
   if ( _sopen_s( &fh, "crt_tell.txt", _O_RDONLY, _SH_DENYNO, 0) )
   {
      char buff[50];
      _strerror_s( buff, sizeof(buff), NULL );
      printf( buff );
      exit( -1 );
   }
   if( _read( fh, buffer, 500 ) > 0 )
      printf( "Current file position is: %d\n", _tell( fh ) );
   _close( fh );
}
输入:crt_tell.txt
Line one.
Line two.
Output
Current file position is: 20