TransmitCommChar

2.x

  int TransmitCommChar(idComDev, chTransmit)    
  int idComDev; /* communications device, */  
  char chTransmit; /* character to transmit */

The TransmitCommChar function places the specified character at the head of the transmission queue for the specified device.

Parameters

idComDev

Specifies the communications device to transmit the character. The OpenComm function returns this value.

chTransmit

Specifies the character to be transmitted.

Return Value

The return value is zero if the function is successful. It is less than zero if the character cannot be transmitted.

Comments

The TransmitCommChar function cannot be called repeatedly if the device is not transmitting. Once TransmitCommChar places a character in the transmission queue, the character must be transmitted before the function can be called again. TransmitCommChar returns an error if the previous character has not yet been sent.

Example

The following example uses the TransmitCommChar function to send characters from the keyboard to the communications port:

case WM_CHAR:

    ch = (char)wParam;
    TransmitCommChar(idComDev, ch);

    /* Add a linefeed for every carriage return. */

    if (ch == 0x0d)
        TransmitCommChar(idComDev, 0x0a);

    break;

See Also

OpenComm, WriteComm