comReadChar(
const handle) // async handle
Reads a character from the input queue. If no character is
available, comReadChar will wait for a character up
to the current read timeout setting.
comReadChar does a buffered read minimizing system overhead.
It performs better for single character processing than comRead.
Example:
var hdl = comOpen('com1');
comReadTimeout(hdl,5000);
comWrite(hdl, 'Send a character, you have 5 seconds: ');
var data = comReadChar(hdl);
if (data == '')
comWrite(hdl, 'timed out');
else
comWrite(hd1, 'thanks!');
comClose(hdl);
|