5 This file is part of the Public Domain C Library (PDCLib).
6 Permission is granted to use, modify, and / or redistribute at will.
13 void clearerr( struct _PDCLIB_file_t * stream )
15 stream->status &= ~( _PDCLIB_ERRORFLAG | _PDCLIB_EOFFLAG );
21 #include <_PDCLIB_test.h>
26 TESTCASE( ( fh = tmpfile() ) != NULL );
27 /* Flags should be clear */
28 TESTCASE( ! ferror( fh ) );
29 TESTCASE( ! feof( fh ) );
30 /* Reading from input stream - should provoke error */
31 TESTCASE( fgetc( fh ) == EOF );
32 TESTCASE( ferror( fh ) );
33 TESTCASE( ! feof( fh ) );
34 /* clearerr() should clear flags */
36 TESTCASE( ! ferror( fh ) );
37 TESTCASE( ! feof( fh ) );
38 /* Reading from empty stream - should provoke EOF */
40 TESTCASE( fgetc( fh ) == EOF );
41 TESTCASE( ! ferror( fh ) );
42 TESTCASE( feof( fh ) );
43 /* clearerr() should clear flags */
45 TESTCASE( ! ferror( fh ) );
46 TESTCASE( ! feof( fh ) );
47 TESTCASE( fclose( fh ) == 0 );