Error getting tags :
error 404Error getting tags :
error 404 read from driver | revDocs | RunRev
Welcome Guest (Log in)
Product Edition
Version
read from driver
Basics
Expander triangle
Type
Command
Syntax

read from driver deviceName [at start] {until {string | end | EOF | empty} | for amount [chunkType]} [in time]

Introduced
1.1.1
Changed
2.0
Environment
Desktop, Web and Server
Platform Support
MacOS,Mac OS X,Windows,Linux
Security
None required
Summary
Takes incoming data from a device that has been opened with the open driver command, and places the data in the it variable.
Examples

read from driver ".BIn" for 3 lines
read from driver it for 2 chars in 2 seconds

Additional Comments
Expander triangle

Use the read from driver command to get data from a peripheral device such as a modem.

Parameters:

The deviceName is the name of a device driver that's installed on the system and that you have previously opened with the open driver command.

The start specifies the character or byte position in the device's input where you want to begin reading.

The string is any expression that evaluates to a string. When Revolution encounters the string in the data coming in from the device, it stops reading. If the string is not encountered, the read from driver command continues reading as long as there is data to be read.

The amount is a positive integer and specifies how much data to read.

The chunkType is one of chars, characters, words, items, lines, int1, uInt1, int2, uint2, int4, or uint4. The read from driver command reads amount of the specified chunkType. If you don't specify a chunkType, amount characters are read.

The time is the time to wait for the read to be completed, in milliseconds, seconds, or ticks.

Comments:

The device to read from must be opened first with the open driver command, and the mode the device was opened in must be either read or update. If the device is not open or is open write-only, the result function is set to "File is not open for read.".

The until string form reads data until the specified string is encountered. The until empty, until end, and until EOF forms read data until there is no more data to be read.

The data is placed in the it variable after reading. If you specified a binary data chunkType (int1, uInt1, int2, uint2, int4, or uint4), the data consists of a comma-separated list of numbers, one for the numerical value of each chunk that was read. Otherwise, the data is placed in the it variable as it appears in the output.

If you specify a time and the read is not completed when that time has elapsed, the result function is set to "time out". If the read was successful, the result is set to empty.

Changes to Revolution:

Support for using serial drivers with OS X systems was added in version 2.0.

User Comments
Expander triangle