ClearCommError function (winbase.h)
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 ClearCommError(
[in] HANDLE hFile,
[out, optional] LPDWORD lpErrors,
[out, optional] LPCOMSTAT lpStat
);
Parameters
[in] hFile
A handle to the communications device. The CreateFile function returns this handle.
[out, optional] 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.
The following values are not supported:
[out, optional] 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, the return value is nonzero.
If the function fails, the return value is zero. 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 ClearCommError function.
The ClearCommError function fills the status buffer pointed to by the lpStat parameter with the current status of the communications device specified by the hFile parameter.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows XP [desktop apps | UWP apps] |
Minimum supported server | Windows Server 2003 [desktop apps | UWP apps] |
Target Platform | Windows |
Header | winbase.h (include Windows.h) |
Library | Kernel32.lib |
DLL | Kernel32.dll |