6515ffdaca08e52ef5bda6cb880d08fab4a64929
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS system libraries
4 * FILE: lib/msvcrt/io/read.c
5 * PURPOSE: Reads a file
6 * PROGRAMER: Boudewijn Dekker
11 #include <msvcrt/io.h>
12 #include <msvcrt/internal/file.h>
15 #include <msvcrt/msvcrtdbg.h>
17 size_t _read(int _fd
, void *_buf
, size_t _nbyte
)
19 DWORD _rbyte
= 0, nbyte
= _nbyte
, count
;
21 char *bufp
= (char*)_buf
;
23 DPRINT("_read(fd %d, buf %x, nbyte %d)\n", _fd
, _buf
, _nbyte
);
27 if (!ReadFile(_get_osfhandle(_fd
), bufp
, nbyte
, &_rbyte
, NULL
))
33 if (__fileno_getmode(_fd
) & O_TEXT
)
51 DPRINT("%d\n", _nbyte
- nbyte
);
52 return _nbyte
- nbyte
;