A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/language/../error/error_code/../../../cpp/io/c/clearerr.html below:

std::clearerr - cppreference.com

#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");
}

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4