This repository has been archived on 2024-12-16. You can view files and clone it, but cannot push or open issues or pull requests.
CodeBlocksPortable/WATCOM/samples/clibexam/clearerr.c

18 lines
315 B
C
Raw Normal View History

#include <stdio.h>
void main()
{
FILE *fp;
int c;
c = 'J';
fp = fopen( "file", "w" );
if( fp != NULL ) {
fputc( c, fp );
if( ferror( fp ) ) { /* if error */
clearerr( fp ); /* clear the error */
fputc( c, fp ); /* and retry it */
}
}
}