1 #include <msvcrt/stdio.h>
2 #include <msvcrt/internal/file.h>
4 FILE * __alloc_file(void);
7 FILE *_fdopen(int handle, char *mode)
27 file = __alloc_file();
32 rw = (mode[1] == '+') || (mode[1] && (mode[2] == '+'));
35 _lseek(handle, 0, SEEK_END);
41 // The mode of the stream must be compatible with the mode of the file descriptor.
42 // this should be checked.
45 file->_flag = _IOREAD | _IOWRT;
46 else if (*mode == 'r')
47 file->_flag = _IOREAD;
51 file->_base = file->_ptr = NULL;