IFREAD(3)
HP-UX
NAME
ifread − reads a block of data from the formatted I/O buffer
SYNOPSIS
#include <sicl.h>
int ifread (
INST id,
char *buf,
unsigned long bufsize,
int *reason,
unsigned long *actualcnt
);
DESCRIPTION
This function reads a block of data from the formatted I/O read buffer (the same buffer used by iscanf). The buf argument is a pointer to the location where the block of data can be stored.
The bufsize argument is an unsigned long integer containing the size, in bytes of the buffer specified in buf.
The reason argument is a pointer to an integer that, upon exiting ifread, contains the reason why the read terminated. If the reason parameter contains a zero (0) then no termination reason is returned. Reasons include:
I_TERM_MAXCNT bufsize characters read;
I_TERM_END END indicator received on last character;
I_TERM_CHR Termination character enabled and received;
The actualcnt argument is a pointer to an unsigned long integer which upon exit, contains the actual number of bytes read from the formatted I/O read buffer.
This function acts identically to the iread function, except the data is not read directly from the device, instead it is read from the formatted I/O read buffer. The advantage to this function over iread is that it can be intermixed with iscanf, while iread may not. This function obeys the itermchr termination character, if any, for the specified session. The read terminates only on one of the following conditions:
* it read bufsize number of bytes
* it found a byte with the END indicator attached
* it found the current termination character in the read buffer (set
with itermchr)
* an error has occurred
RETURN VALUE
ifread returns (0) if successful, or a non-zero error code if an error was encountered.
ERRORS
ifread fails under the following circumstances, and sets the return value to one of the following:
[I_ERR_NORSRC] Out of system resources
[I_ERR_NOINTF] Interface is not active
[I_ERR_NODEV] Device is not active
[I_ERR_BADID] The INST id is invalid
[I_ERR_BADADDR] Invalid address (device/interface doesn’t exist)
SEE ALSO
iread, itermchr, iflush, ifwrite, iprintf, iscanf, isetbuf, isetubuf
AUTHOR
ifread was developed by HP.
Hewlett-Packard Company — May 05, 1994