KsReadFile
The availability of this function depends on what the device supports.
Reads data from the COM port if available.
Syntax
BOOL KsReadFile(
HANDLE hFile,
LPVOID lpBuffer,
DWORD nNumberOfBytesToRead,
LPDWORD lpNumberOfBytesRead,
LPOVERLAPPED lpOverlapped
);
Parameters
hFile: the port to be read.
lpBuffer: a pointer to the buffer that receives the data read from the file.
nNumberOfBytesToRead: the number of bytes to be read from the file.
lpNumberOfBytesRead: a pointer to the number of bytes read. KsReadFile sets this value to zero before doing any work or error checking.
lpOverlapped (not supported): this parameter must be set to NULL.
Return value
If the function succeeds, it returns TRUE, otherwise FALSE. To get extended error information, call GetLastError.
NOTE: If the return value is TRUE and the number of bytes read is zero, there was no data to read at the time of the read operation.
Remarks
KsReadFile returns when the number of bytes requested has been read, or an error occurs.
If part of the file is locked by another process and the read operation overlaps the locked portion, this function fails.
Applications must not read from nor write to the input buffer that a read operation is using until the read operation completes. A premature access to the input buffer may lead to corruption of the data read into that buffer.
When a synchronous read operation reaches the end of a file, KsReadFile returns TRUE and sets *lpNumberOfBytesRead
to zero.
Example
N/A
Requirements
RT | Win32 | |
---|---|---|
Minimum supported version | 4.0 | 4.0 |
Header | kscom.h | kscom.h |
Library | KsApi_Rtss.lib | ksapi.h |
See also