A RetroSearch Logo

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

Search Query:

Showing content from https://en.cppreference.com/w/cpp/algorithm/ranges/../../../cpp/../cpp/../c/io/clearerr.html below:

clearerr - cppreference.com

void clearerr( FILE *stream );

Resets the error flags and the EOF indicator for the given file stream.

[edit] Parameters stream - the file to reset the error flags for [edit] Return value

(none)

[edit] Example
#include <stdio.h>
#include <assert.h>
 
int main(void)
{
    FILE* tmpf = tmpfile();
    fputs("cppreference.com\n", tmpf);
    rewind(tmpf);
 
    for (int ch; (ch = fgetc(tmpf)) != EOF; putchar(ch)) { }
 
    assert(feof(tmpf)); // the loop is expected to terminate by EOF
    puts("End of file reached");
 
    clearerr(tmpf); // clear EOF
 
    puts(feof(tmpf) ? "EOF indicator set" 
                    : "EOF indicator cleared");
}

Output:

cppreference.com
End of file reached
EOF indicator cleared
[edit] References
[edit] See also

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