std::clearerr
From cppreference.com
 
 
 
 
 
 C++ 
 Feature test macros (C++20)
 Concepts library (C++20)
 Metaprogramming library (C++11)
 Ranges library (C++20)
 Filesystem library (C++17)
 Concurrency support library (C++11)
 Execution control library (C++26)
Input/output library 
 
 
 
 
 
 
 
 
 
 
 
 
 Print functions (C++23)
 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
 File access
 Direct input/output
 Unformatted input/output
 Formatted input
(C++11)(C++11)(C++11)    
(C++11)(C++11)(C++11)    
 Formatted output
(C++11)
(C++11)    
 File positioning
 Error handling
clearerr
 Operations on files
Defined in header 
 
 
<cstdio> 
 void clearerr( std::FILE * stream );
 
 
Resets the error flags and the EOF indicator for the given file stream.
Contents
[edit] Parameters
 stream
 -
 the file to reset the error flags for
[edit] Return value
(none)
[edit] Example
Run this code
#include <cassert> #include <cstdio> int main() { std::FILE * tmpf = std::tmpfile (); std::fputs ("cppreference.com\n", tmpf); std::rewind (tmpf); for (int ch; (ch = std::fgetc (tmpf)) != EOF ; std::putchar (ch)) { } assert (std::feof (tmpf)); // the loop is expected to terminate by EOF std::puts ("End of file reached"); std::clearerr(tmpf); // clear EOF std::puts (std::feof (tmpf) ? "EOF indicator set" : "EOF indicator cleared"); }
Output:
cppreference.com End of file reached EOF indicator cleared
[edit] See also
C documentation  for clearerr