3 This file is part of the Public Domain C Library (PDCLib).
4 Permission is granted to use, modify, and / or redistribute at will.
10 #include <_PDCLIB_io.h>
12 extern FILE * _PDCLIB_filelist;
14 int _PDCLIB_fflush_unlocked( FILE * stream )
18 stream = _PDCLIB_filelist;
19 /* TODO: Check what happens when fflush( NULL ) encounters write errors, in other libs */
21 while ( stream != NULL )
23 if ( stream->status & _PDCLIB_FWRITE )
25 if ( _PDCLIB_flushbuffer( stream ) == EOF )
30 stream = stream->next;
36 return _PDCLIB_flushbuffer( stream );
40 int fflush( FILE * stream )
42 _PDCLIB_flockfile( stream );
43 int res = _PDCLIB_fflush_unlocked(stream);
44 _PDCLIB_funlockfile( stream );
51 #include <_PDCLIB_test.h>
55 /* Testing covered by ftell.c */