FreeBSD Manual Pages
std::clearerr(3) C++ Standard Libary std::clearerr(3) NAME std::clearerr - std::clearerr Synopsis Defined in header <cstdio> void clearerr( std::FILE* stream ); Resets the error flags and the EOF indicator for the given file stream. Parameters stream - the file to reset the error flags for Return value (none) 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 See also feof checks for the end-of-file (function) perror displays a character string corresponding of the current er- ror to stderr (function) ferror checks for a file error (function) C documentation for clearerr http://cppreference.com 2024.06.10 std::clearerr(3)
NAME | Synopsis | Parameters | Return value | Example | Output: | See also
Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::clearerr&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>
