blob: 881e7fe2d78d14599fa65f197580352a2c973c50 [file] [log] [blame] [raw]
/*
* read.c: read and _read implementations for WinCE.
*
* This file has no copyright assigned and is placed in the Public Domain.
* This file is a part of the mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within the package.
*
* Written by Pedro Alves <pedro_alves@portugalmail.pt> Feb 2007
*
*/
#include <unistd.h>
#include <windows.h>
int _read(int fd, void *buf, size_t bufsize)
{
unsigned long int r;
if(bufsize > 0x7fffffff) bufsize = 0x7fffffff;
if(!ReadFile((void *)fd, buf, bufsize, (unsigned long int *)&r, NULL)) return -1;
return (int)r;
}
int read(int fd, void *buf, size_t bufsize)
{
return _read(fd, buf, bufsize);
}