Casio IT-2000W User Manual

Page 134

Advertising
background image

134

WriteComm

int WriteComm(idComDev, lpvBuf, cbWrite)

int idComDev;

/* Communication device ID */

const void FAR * lpvBuf;

/* Address of the data buffer */

int cbWrite;

/* Number of bytes to write */

The WriteComm function will write to the specified communication device.

< Parameter >

idComDev:

Specifies the device that receives the data. The OpenComm function returns this

value.

lpvBuf:

Pointer to the buffer that stores the bytes to write.

cbWrite:

Specifies the number of bytes to write.

< Return value >

This function returns the number of bytes written if the function is terminated normally. Otherwise it

returns a value less than zero, and the absolute value of the return value indicates the number of

bytes that were written.

Note:

To judge if an error occurred, use the GetCommError function to acquire the error value and error

status. In the case of a serial port, the WriteComm function will delete the data in the transmission

queue, if it is full and has no space for more byte data. Therefore, before calling the WriteComm

function, the application should call the GetCommError function to check for available memory

space in the transmission queue. In addition, use the OpenComm function to set the size of the

transmission queue to a value greater than the maximum possible size of the outputted character

string.

Note on IrDA:

Even if the transmission queue contains zero bytes of transmission characters, untransmitted data

remain in the IrDA driver.

Advertising