void clearerr(FILE* qpStream);
#include <cstdio>
int main()
{
// Read from the output stream to create an error.
getc(stdout);
// Verify that the stream has an error.
if (ferror(stdout)) {
perror("Error in stdout");
} else {
printf("No error in stdout\
");
}
// Clear the stream
clearerr(stdout);
// Verify that the error was cleared.
if (ferror(stdout)) {
perror("Error in stdout");
} else {
printf("No error in stdout\
");
}
return 0;
}
© 20072025 XoaX.net LLC. All rights reserved.