3 This file is part of the Public Domain C Library (PDCLib).
4 Permission is granted to use, modify, and / or redistribute at will.
11 void clearerr( struct _PDCLIB_file_t * stream )
13 stream->status &= ~( _PDCLIB_ERRORFLAG | _PDCLIB_EOFFLAG );
19 #include <_PDCLIB_test.h>
24 TESTCASE( ( fh = tmpfile() ) != NULL );
25 /* Flags should be clear */
26 TESTCASE( ! ferror( fh ) );
27 TESTCASE( ! feof( fh ) );
28 /* Reading from input stream - should provoke error */
29 /* FIXME: Apparently glibc disagrees on this assumption. How to provoke error on glibc? */
30 TESTCASE( fgetc( fh ) == EOF );
31 TESTCASE( ferror( fh ) );
32 TESTCASE( ! feof( fh ) );
33 /* clearerr() should clear flags */
35 TESTCASE( ! ferror( fh ) );
36 TESTCASE( ! feof( fh ) );
37 /* Reading from empty stream - should provoke EOF */
39 TESTCASE( fgetc( fh ) == EOF );
40 TESTCASE( ! ferror( fh ) );
41 TESTCASE( feof( fh ) );
42 /* clearerr() should clear flags */
44 TESTCASE( ! ferror( fh ) );
45 TESTCASE( ! feof( fh ) );
46 TESTCASE( fclose( fh ) == 0 );