rewind
파일 포인터를 파일의 시작 부분으로 다시 설정합니다.
void rewind(
FILE *stream
);
매개 변수
- stream
포인터를 파일 구조체입니다.
설명
해당 되감기 기능 재배치와 관련 파일 포인터 stream 파일의 시작 부분에.호출을 되감기 유사 합니다
(void) fseek( stream**,** 0L, SEEK_SET );
그러나, 달리 fseek, 되감기 오류 표시기 스트림에 대 한 뿐만 아니라 파일 끝 표시기를 지웁니다.또한, 달리 fseek, 되감기 포인터 이동 했습니다 여부를 나타내는 값을 반환 하지 않습니다.
키보드 버퍼를 지울 수 있습니다 되감기 스트림을 사용 하 여 stdin, 기본적으로 키보드와 관련 된입니다.
스트림의 경우는 NULL 포인터를 잘못 된 매개 변수 처리기 호출에서에 설명 된 대로 매개 변수 유효성 검사.이 함수는 실행 계속할 수 있는지 여부를 반환 하 고 errno 로 설정 됩니다 EINVAL.
이러한 문제 및 기타 오류 코드에 대 한 내용은 _doserrno, errno, _sys_errlist, 및 _sys_nerr.
요구 사항
루틴 |
필수 헤더 |
---|---|
되감기 |
<stdio.h> |
추가 호환성 정보를 참조 하십시오. 호환성 소개에서 합니다.
라이브러리
모든 버전의 C 런타임 라이브러리.
예제
// crt_rewind.c
/* This program first opens a file named
* crt_rewind.out for input and output and writes two
* integers to the file. Next, it uses rewind to
* reposition the file pointer to the beginning of
* the file and reads the data back in.
*/
#include <stdio.h>
int main( void )
{
FILE *stream;
int data1, data2;
data1 = 1;
data2 = -37;
fopen_s( &stream, "crt_rewind.out", "w+" );
if( stream != NULL )
{
fprintf( stream, "%d %d", data1, data2 );
printf( "The values written are: %d and %d\n", data1, data2 );
rewind( stream );
fscanf_s( stream, "%d %d", &data1, &data2 );
printf( "The values read are: %d and %d\n", data1, data2 );
fclose( stream );
}
}
Output
The values written are: 1 and -37
The values read are: 1 and -37
해당 .NET Framework 항목
해당 사항 없음. 표준 C 함수를 호출할 수 있습니다 PInvoke. 자세한 내용은 플랫폼 호출 예제.