| Цитата(MSDN) | ReadFile
The ReadFile function reads data from a file, starting at the position that the file pointer indicates. You can use this function for both synchronous and asynchronous operation.
The ReadFileEx function is for only asynchronous operation.
| Код | BOOL ReadFile( HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped );
|
Return Values The ReadFile function returns when one of the following conditions occur:
- A write operation completes on the write end of the pipe.
- The number of bytes requested is read.
- An error occurs.
If the function succeeds, the return value is nonzero.
If the function fails, the return value is 0 (zero). To get extended error information, call GetLastError.
If the return value is nonzero and the number of bytes read is 0 (zero), the file pointer is beyond the current end of the file at the time of the read operation. However, if the file is opened with FILE_FLAG_OVERLAPPED and lpOverlapped is not NULL, the return value is 0 (zero) and GetLastError returns ERROR_HANDLE_EOF when the file pointer goes beyond the current end of file.
|
|