# SPORT_GET_STATE_EX (W*S)

Serial Port I/O Function: Returns the baud rate, parity, data bits setting, stop bits, and other settings of the communications port.

## Module

USE IFPORT

result = SPORT_GET_STATE_EX (port[,baud] [,parity] [,dbits] [,sbits] [,Binmode] [,DTRcntrl]

[,RTScntrl] [,OutCTSFlow] [,OutDSRFlow] [,DSRSense] [,OutXonOff] [,InXonOff] [,XonLim]

[,XoffLim] [,TXContOnXoff] [,ErrAbort] [,ErrCharEnbl] [,NullStrip] [,XonChar] [,XoffChar]

[,ErrChar] [,EofChar] [,EvtChar])

port | (Input) Integer. The port number.
baud | (Input; optional) Integer. The baud rate of the port.
parity | (Output; optional) Integer. The parity setting of the port (0-4 = no, odd, even, mark, space).
dbits | (Output; optional) Integer. The data bits for the port.
sbits | (Output; optional) Integer. The stop bits for the port (0, 1, 2 = 1, 1.5, 2).
Binmode | (Output; optional) Integer. 1 if binary mode is enabled; otherwise, 0. Currently, the value of this parameter is always 1.
DTRcntrl | (Output; optional) Integer. 1 if DTR (data-terminal-ready) flow control is used; otherwise, 0.
RTScntrl | (Output; optional) Integer. 1 if RTS (request-to-send) flow control is used; otherwise, 0.
OutCTSFlow | (Output; optional) Integer. 1 if the CTS (clear-to-send) signal is monitored for output flow control; otherwise, 0.
OutDSRFlow | (Output; optional) Integer. 1 if the DSR (data-set-ready) signal is monitored for output flow control; otherwise, 0.
DSRSense | (Output; optional) Integer. 1 if the communications driver is sensitive to the state of the DSR signal; otherwise, 0.
OutXonOff | (Output; optional) Integer. 1 if XON/XOFF flow control is used during transmission; otherwise, 0.
InXonOff | (Output; optional) Integer. 1 if XON/XOFF flow control is used during reception; otherwise, 0.
XonLim | (Output; optional) Integer. The minimum number of bytes accepted in the input buffer before the XON character is set.
XoffLim | (Output; optional) Integer. The maximum number of bytes accepted in the input buffer before the XOFF character is set.
TXContOnXoff | (Output; optional) Integer. 1 if transmission stops when the input buffer is full and the driver has transmitted the XoffChar character; otherwise, 0.
ErrAbort | (Output; optional) Integer. 1 if read and write operations are terminated when an error occurs; otherwise, 0.
ErrCharEnbl | (Output; optional) Integer. 1 if bytes received with parity errors are replaced with the ErrChar character; otherwise, 0.
NullStrip | (Output; optional) Integer. 1 if null bytes are discarded; otherwise, 0.
XonChar | (Output; optional) Character. The value of the XON character that is used for both transmission and reception.
XoffChar | (Output; optional) Character. The value of the XOFF character that is used for both transmission and reception.
ErrChar | (Output; optional) Character. The value of the character that is used to replace bytes received with parity errors.
EofChar | (Output; optional) Character. The value of the character that is used to signal the end of data.
EvtChar | Output; optional) Character. The value of the character that is used to signal an event.

## Results

The result type is INTEGER(4). The result is zero if successful; otherwise, a Windows* error value.

## Example

    USE IFPORT
    INTEGER(4) iresult
    INTEGER(4) port, baud, parity, dbits, sbits
    INTEGER(4) OutXonOff, InXonOff, OutDSRFlow
    INTEGER(4) OutCTSFlow, DTRcntrl,  RTScntrl
    INTEGER(4) DSRSense, XonLim, XoffLim
    CHARACTER(1) XonChar, XoffChar
    iresult = SPORT_GET_STATE_EX(port, baud, parity, dbits, sbits,               &
                  OutXonOff=OutXonOff, InXonOff=InXonOff, OutDSRFlow=OutDSRFlow, &
                  OutCTSFlow=OutCTSFlow, DTRcntrl=DTRcntrl, RTScntrl=RTScntrl,   &
                  DSRSense = DSRSense, XonChar = XonChar, XoffChar = XoffChar,   &
                  XonLim=XonLim, XoffLim=XoffLim)
    END

Parent topic: Serial Port I/O Library Routines

## See Also

SPORT_GET_STATE
SPORT_SET_STATE_EX

Communications, Communications Functions, and SetCommState in the Microsoft* Platform SDK