1 #include <msvcrt/stdio.h>
2 #include <msvcrt/internal/file.h>
4 FILE * __alloc_file(void);
10 FILE *_fdopen(int handle, char *mode)
30 file = __alloc_file();
35 rw = (mode[1] == '+') || (mode[1] && (mode[2] == '+'));
38 _lseek(handle, 0, SEEK_END);
44 // The mode of the stream must be compatible with the mode of the file descriptor.
45 // this should be checked.
48 file->_flag = _IOREAD | _IOWRT;
49 else if (*mode == 'r')
50 file->_flag = _IOREAD;
54 file->_base = file->_ptr = NULL;