1 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
3 #include <msvcrt/stdio.h>
5 #include <msvcrt/sys/types.h>
6 #include <msvcrt/sys/stat.h>
7 #include <msvcrt/stdlib.h>
8 #include <msvcrt/errno.h>
9 #include <msvcrt/internal/file.h>
11 // changed check for writable stream
29 // flush only if stream was opened for writing
30 if ( !(f->_flag&_IOSTRG) ) {
31 if ( OPEN4WRITING(f) )
34 if (_close(fileno(f)) < 0)
36 if (f->_flag&_IOMYBUF)
39 // Kernel might do this later
40 if (f->_flag & _IORMONCL && f->_name_to_remove)
42 remove(f->_name_to_remove);
43 free(f->_name_to_remove);
44 f->_name_to_remove = 0;