std:: clearerr
From cppreference.net
C++
Input/output library
| I/O manipulators | ||||
| Print functions (C++23) | ||||
| C-style I/O | ||||
| Buffers | ||||
|
(C++23)
|
||||
|
(
C++98/26*
)
|
||||
|
(C++20)
|
||||
| Streams | ||||
| Abstractions | ||||
| File I/O | ||||
| String I/O | ||||
| Array I/O | ||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(
C++98/26*
)
|
||||
|
(
C++98/26*
)
|
||||
|
(
C++98/26*
)
|
||||
| Synchronized Output | ||||
|
(C++20)
|
||||
| Types | ||||
| Error category interface | ||||
|
(C++11)
|
||||
|
(C++11)
|
C-style I/O
| Types and objects | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
헤더 파일에 정의됨
<cstdio>
|
||
|
void
clearerr
(
std::
FILE
*
stream
)
;
|
||
주어진 파일 스트림에 대한 오류 플래그와
EOF
지시자를 재설정합니다.
목차 |
매개변수
| stream | - | 오류 플래그를 재설정할 파일 |
반환값
(없음)
예제
이 코드 실행
#include <cassert> #include <cstdio> int main() { std::FILE* tmpf = std::tmpfile(); std::fputs("cppreference.net\n", tmpf); std::rewind(tmpf); for (int ch; (ch = std::fgetc(tmpf)) != EOF; std::putchar(ch)) { } assert(std::feof(tmpf)); // 루프가 EOF로 종료될 것으로 예상됨 std::puts("End of file reached"); std::clearerr(tmpf); // EOF 클리어 std::puts(std::feof(tmpf) ? "EOF indicator set" : "EOF indicator cleared"); }
출력:
cppreference.net End of file reached EOF indicator cleared
참고 항목
|
파일 끝 확인
(함수) |
|
|
현재 오류에 해당하는 문자열을
stderr
에 출력
(함수) |
|
|
파일 오류 확인
(함수) |
|
|
C documentation
for
clearerr
|
|