please dont rip this site Prev Next

ClearCommError info  Overview  Group

The ClearCommError function 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.

BOOL ClearCommError(

    HANDLE hFile,

// handle to communications device

    LPDWORD lpErrors,

// pointer to variable to receive error codes

    LPCOMSTAT lpStat

// pointer to buffer for communications status



Identifies the communications device. The CreateFile function returns this handle.
Points to a 32-bit variable to be filled with a mask indicating the type of error. This parameter can be one or more of the following error codes:




The hardware detected a break condition.


Windows 95 only: A parallel device is not selected.


The hardware detected a framing error.


An I/O error occurred during communications with the device.


The requested mode is not supported, or the hFile parameter is invalid. If this value is specified, it is the only valid error.


Windows 95 only: A parallel device signaled that it is out of paper.


A character-buffer overrun has occurred. The next character is lost.


Windows 95 only: A time-out occurred on a parallel device.


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.


The hardware detected a parity error.


The application tried to transmit a character, but the output buffer was full.

Points to a COMSTAT structure in which the device’s status information is returned. If lpStat is NULL, no status information is returned.

Return Values

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.


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.

See Also

ClearCommBreak, COMSTAT, CreateFile, DCB

See also:

file: /Techref/os/win/api/win32/func/src/f05_14.htm, 6KB, , updated: 2000/4/7 12:19, local time: 2022/5/18 02:06,

 ©2022 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF=""> ClearCommError</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

  PICList 2022 contributors:
o List host: MIT, Site host, Top posters @20220518
* Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.

Welcome to!