5 This file is part of the Public Domain C Library (PDCLib).
6 Permission is granted to use, modify, and / or redistribute at will.
12 #include <_PDCLIB_io.h>
14 extern FILE * _PDCLIB_filelist;
16 int _PDCLIB_fflush_unlocked( FILE * stream )
20 stream = _PDCLIB_filelist;
21 /* TODO: Check what happens when fflush( NULL ) encounters write errors, in other libs */
23 while ( stream != NULL )
25 if ( stream->status & _PDCLIB_FWRITE )
27 if ( _PDCLIB_flushbuffer( stream ) == EOF )
32 stream = stream->next;
38 return _PDCLIB_flushbuffer( stream );
42 int fflush( FILE * stream )
44 _PDCLIB_flockfile( stream );
45 int res = _PDCLIB_fflush_unlocked(stream);
46 _PDCLIB_funlockfile( stream );
53 #include <_PDCLIB_test.h>
57 /* Testing covered by ftell.c */