trmcom

  int trmcom(cid)    
  int cid;    

The trmcom function closes the specified communications device and frees any memory allocated for the device's transmit and receive queues. All characters in the output queue are transmitted before the communications device is closed unless an error occurs. The trmcom function returns an error immediately if the cid parameter is not valid, and returns an error if a timeout occurs while attempting to send the characters.

USER calls this function whenever an application calls the CloseComm function (USER.207).

Parameters

cid

Identifies the communications device.

Return Value

The return value is zero if the function is successful. The function returns -2 if an error occurred while transmitting the remaining characters from the transmit queue. If the cid parameter is not valid, trmcom will return 0x8000.

Comments

The export ordinal for this function is 7.

If the return value is -2, the function may have left some characters in the transmit queue, but may have successfully sent others. If an application subsequently calls the stacom through the GetCommError function (USER.203), the driver should set the cbOutQue member in the COMSTAT structure to allow the application to determine how many characters were actually transmitted.

See Also

inicom