Flush any data within the driver抯 input/output buffer.
Language Syntax
C/C++ int WINAPI sio_flush(int port, int func)
Visual Basic Function sio_flush (ByVal port As Long, ByVal func As Long) As Long
Delphi function sio_flush(port, func: Longint): Longint;
Argument:
port = COM port number
func = flush function
0 : flush input buffer
1 : flush output buffer
2 : flush input & output buffer
Return:
SIO_OK OK
SIO_BADPORT Port is not opened in advance
SIO_BADPARM Bad parameter
SIO_WIN32FAIL Calling Win32 function failed
Call GetLastError to get the error code
Example:
Flush COM2 input & output buffer:
C/C++
ret = sio_flush ( 2, 2 );
if (ret != SIO_OK) {
/* Fail */
}
Visual Basic
ret = sio_flush ( 2, 2 )
If ret <> SIO_OK Then
慒ail
End If
Delphi
ret := sio_flush ( 2, 2 );
if ret <> SIO_OK then
begin
{ Fail }
end;