KsClearCommError
The availability of this function depends on what the device supports.
Retrieves information about a communications error and reports the current status of a communications device. The function is called when a communications error occurs, and it clears the device's error flag to enable additional input and output (I/O) operations.
Syntax
BOOL KsClearCommError(
HANDLE hFile,
LPDWORD lpErrors,
LPCOMSTAT lpStat
);
Parameters
hFile: a handle to the communications device. The KsCreateComm function returns this handle.
lpErrors: a pointer to a variable that receives a mask indicating the type of error. This parameter can be one or more of the following values.
Value | Description |
---|---|
CE_BREAK 0x0010 |
The hardware detected a break condition. |
CE_FRAME 0x0008 |
The hardware detected a framing error. |
CE_OVERRUN 0x0002 |
A character-buffer overrun has occurred. The next character is lost. |
CE_RXOVER 0x0001 |
An input buffer overflow has occurred. There is either no room in the input buffer, or a character was received after the end-of-file (EOF) character. |
CE_RXPARITY 0x0004 |
The hardware detected a parity error. |
lpStat: a pointer to a COMSTAT structure in which the device's status information is returned. If this parameter is NULL, no status information is returned.
Return value
If the function succeeds, it returns TRUE, otherwise FALSE. To get extended error information, call GetLastError.
Remarks
If a communications port has been set up with a TRUE value for the fAbortOnError
member of the setup DCB structure, the communications software will terminate all read and write operations on the communications port when a communications error occurs. No new read or write operations will be accepted until the application acknowledges the communications error by calling the KsClearCommError function.
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