]> pd.if.org Git - pdclib/blob - functions/_PDCLIB/fflush.c
3d26b400d079611476859eb3d54cbf1eb90bd7d5
[pdclib] / functions / _PDCLIB / fflush.c
1 /* $Id$ */
2
3 /* _PDCLIB_fflush( FILE * )
4
5    This file is part of the Public Domain C Library (PDCLib).
6    Permission is granted to use, modify, and / or redistribute at will.
7 */
8
9 #include <stdio.h>
10
11 int _PDCLIB_fflush( struct _PDCLIB_file_t * stream )
12 {
13     if ( fwrite( stream->buffer, stream->bufidx, 1, stream ) == stream->bufidx )
14     {
15         stream->bufidx = 0;
16         return 0;
17     }
18     else
19     {
20         stream->status |= _PDCLIB_ERRORFLAG;
21         return EOF;
22     }
23 }
24                 
25 #ifdef TEST
26 #include <_PDCLIB_test.h>
27
28 int main( void )
29 {
30     TESTCASE( NO_TESTDRIVER );
31     return TEST_RESULTS;
32 }
33
34 #endif
35