_tell, _telli64
파일 포인터의 위치를 볼 수 있습니다.
long _tell(
int handle
);
__int64 _telli64(
int handle
);
매개 변수
- handle
파일 설명자 파일 열기를 참조 합니다.
반환 값
파일 포인터의 현재 위치입니다.장치에서 검색을 할 수 없는 것, 반환 값은 정의 되지 않습니다.
–1L의 반환 값은 오류를 나타냅니다.경우 handle 는 잘못 된 파일 설명자의 설명에 따라 잘못 된 매개 변수 처리기가 호출 매개 변수 유효성 검사.실행을 계속 수 있으면 이러한 함수를 설정 errno 에 EBADF 및 L-1을 반환 합니다.
참조 하십시오 _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