X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdio%2Ffreopen.c;fp=functions%2Fstdio%2Ffreopen.c;h=e8cc72a1f2924cba8e56c8acc5947ff2525ed7bf;hb=393020b6e48719d27699dea6b29e53025bbd5123;hp=13992deb8214f5fe9f7e7d76584da4a5b1247dc3;hpb=f408c1fd633015089d2a0fc6bc31c9f61eeae0a9;p=pdclib diff --git a/functions/stdio/freopen.c b/functions/stdio/freopen.c index 13992de..e8cc72a 100644 --- a/functions/stdio/freopen.c +++ b/functions/stdio/freopen.c @@ -27,7 +27,7 @@ struct _PDCLIB_file_t * freopen( const char * _PDCLIB_restrict filename, const c /* FIXME: If filename is NULL, change mode. */ /* TODO: This function can change wide orientation of a stream */ if ( filename == NULL ) return NULL; - if ( stream->status & _PDCLIB_WROTELAST ) fflush( stream ); + if ( stream->status & _PDCLIB_FWRITE ) fflush( stream ); if ( stream->status & _PDCLIB_LIBBUFFER ) free( stream->buffer ); _PDCLIB_close( stream->handle ); clearerr( stream ); @@ -37,7 +37,7 @@ struct _PDCLIB_file_t * freopen( const char * _PDCLIB_restrict filename, const c if ( ( stream->buffer = malloc( BUFSIZ ) ) == NULL ) return NULL; stream->bufsize = BUFSIZ; stream->bufidx = 0; - stream->status |= ( _PDCLIB_LIBBUFFER | _PDCLIB_VIRGINSTR ); + stream->status |= _PDCLIB_LIBBUFFER; /* TODO: Setting mbstate */ return stream; }