Application notes
Version 8 dated 15.03.00
190
Siemens Information and Communication Products
8.4.2.15
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.
8.4.2.16
int UngetCommChar(idComDev, chUnget)
int idComDev;
/* communications device
*/
char chUnget;
/* character to place in queue
*/
The UngetCommChar function places the specified character back in the receiving queue. The next read operation will
return this character first.
int TransmitCommChar(idComDev, chTransmit
Parameter
Description
idComDev
Specifies the communications device to transmit the character. The OpenComm function returns
this value.
chTransmit
Specifies the character to be transmitted.
Return value
0 if the function is successful.
< 0 if the character cannot be transmitted.
Example
The following example uses the TransmitCommChar function to send characters from the key-
board 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;
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 pre-
vious character has not yet been sent.
See also
OpenComm, WriteComm
int UngetCommChar(idComDev, chUnget
Parameter
Description
idComDev
Specifies the communications device that will receive the character. The OpenComm function re-
turns this value.
chUnget
Specifies the character to be placed in the receiving queue.
Return value
0 if the function is successful.
Otherwise < 0
Example
None
Comments
Consecutive calls to the UngetCommChar function are not permitted. The character placed in the
queue must be read before this function can be called again.
See also