(int, string) = ReadFile(hFile, buffer/bufSize
, ol
)
Reads a string from a file
Parameters
hFile : PyHANDLE/int
Handle to the filebuffer/bufSize : PyOVERLAPPEDReadBuffer/int
Size of the buffer to create for the read. If a multi-threaded overlapped operation is performed, a buffer object can be passed. If a buffer object is passed, the result is the buffer itself.ol=None : PyOVERLAPPED
An overlapped structure
Comments
in a multi-threaded overlapped environment, it is likely to be necessary to pre-allocate the read buffer using the win32file::AllocateReadBuffer method, otherwise the I/O operation may complete before you can assign to the resulting buffer.
Return Value
The result is a tuple of (hr, string/PyOVERLAPPEDReadBuffer), where hr may be
0, ERROR_MORE_DATA or ERROR_IO_PENDING.
If the overlapped param is not None, then the result is a PyOVERLAPPEDReadBuffer. Once the overlapped IO operation
has completed, you can convert this to a string (str(object))to obtain the data.
While the operation is in progress, you can use the slice operations (object[:end]) to
obtain the data read so far.
You must use the OVERLAPPED API functions to determine how much of the data is valid.