clearerr(3C)
_________________________________________________________________
clearerr function
Clear any error indication on a file.
_________________________________________________________________
Calling Sequence
FILE *fp;
void clearerr();
clearerr(fp);
Description
The clearerr function resets any error indication on the
specified file. Subsequent calls to ferror will report that no
error has occurred until another error actually occurs.
Returns
The clearerr function returns no value.
Related Functions
See also the ferror function.
Example
This is an example of the function clearerr:
/* Program test for the clearerr() function */
#include <stdio.h>
FILE *fp, *fopen();
void clearerr();
main() {
int ch;
fp = fopen("file","w");
fscanf(fp, "%d", &ch);
clearerr(fp);
if (ferror(fp))
printf("Read error.\n");
else
printf("No errors.\n");
return 0;
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
clearerr(3C)
}
This program generates the output
No errors.
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)