Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ iread(3) — HP-UX Instrument Control Library G.03.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

igeterrno(3)

igeterrstr(3)

iprintf(3)

iscanf(3)

iwrite(3)

IREAD(3)

HP-UX

NAME

iread − receive a buffer of data from a device

SYNOPSIS

 #include <sicl.h>
 int iread (
   INST id,
   char *buf,
   unsigned long bufsize,
   int *reason,
   unsigned long *actualcnt
 );

DESCRIPTION

Iread will read data from the session specified by id and store it in the buffer pointed to by buf.  The read is teminated only when bufsize number of bytes is read, a byte is read with the END indicator, or the current termination character (if set with itermchr) is  read.  These conditions may occur in combination. 
 
If id refers to a device, then the data will be read from the device using standard interface communications mechanisms.  If id refers to the controller device driver, then the data will be read from the input buffer of data written to this device from the controller.  If id refers to an interface, then data will be read in raw mode from the interface.  It is up to the interface to provide interface-specific commands for controlling the meaning of this raw data. 
 
If the *reason parameter is not (int *) 0 then on return its value will be a bit mask specifying why the iread terminated.  The following values may be set (note that one more than one reason may be returned):
 

­I_TERM_MAXCNT Set if bufsize number of characters was read. 

­I_TERM_END Set if the END indicator arrived. 

­I_TERM_CHR Set if a termination character is specified and the character was read from the device (see itermchar). 

 
If the *actualcnt paramater is not (unsigned long *) 0 then on return its value will be the number of bytes read. 
 

RETURN VALUE

The iread command returns 0 on success, or a non-zero error number if an error occurred. 

ERRORS

The iread fails under the following circumstances, and sets the return value to one of the following:
 

­[I_ERR_BADID] The INST id is invalid

­[I_ERR_LOCKED] Locked by another user

­[I_ERR_TIMEOUT] Timeout occurred

­[I_ERR_NORSRC] Out of system resources

­[I_ERR_IO] Generic I/O error

­[I_ERR_NODEV] Device is not active

 

SEE ALSO

igeterrno(3), igeterrstr(3), iprintf(3), iscanf(3), iwrite(3)
 

AUTHOR

iread was developed by HP. 

Hewlett-Packard Company  —  September 29, 1999

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026