4 * Ullrich von Bassewitz, 17.06.1998
16 FILE* freopen (const char* name, const char* mode, FILE* f)
18 /* Check if the file is open, if so, close it */
19 if ((f->f_flags & _FOPEN) == 0) {
20 /* File is not open */
21 _errno = EINVAL; /* File not input */
25 /* Close the file. Don't bother setting the flag, it will get
26 * overwritten by _fopen.
28 if (close (f->f_fd) < 0) {
29 /* An error occured, _oserror is set */
33 /* Open the file and return the descriptor */
34 return _fopen (name, mode, f);