comReadChar

C Scripting Language
Reference Manual
Version 4.4.0

<< Back  End  Next >>
 
 
INDEX
Introduction
Installation
Using the CSL executive
Language
Directives
System library
String library
Math library
Regular expression lib.
File library
Database library
Async Communication
   comBits
   comBps
   comClose
   comFlow
   comInputChars
   comOpen
   comParity
   comPurgeInput
   comRead
   comReadChar
   comReadTimeout
   comStops
   comWaitForOutput
   comWrite
Registry/Profile handling
Windows control
C API
C++ Class Interface
CSL links
  
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);
  Copyright © IBK Landquart Last revision: 27.05.2002 << Back  Top  Next >>