comRead

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
  
comRead(
  const handle,     // async handle
  [const maxchars]) // # of bits per char

Reads up to maxchars characters from the input queue. comRead returns immediately when at least 1 character is read. If no character is available, comRead will wait for a character up to the read timeout value.

If maxchars is omitted, 1 is assumed.

Example:

var hdl = comOpen('com1');
comReadTimeout(hdl,5000);
comWrite(hdl, 'Send a character, you have 5 seconds: ');
var data = comRead(hdl,10);
if (data == '')
   comWrite(hdl, 'timed out');
else
   comWrite(hd1, 'thanks!');
comClose(hdl);
  Copyright © IBK Landquart Last revision: 27.05.2002 << Back  Top  Next >>