Guardian C Library Calls Reference Manual
Reference to Library Calls
Guardian TNS C Library Calls Reference Manual—128833 3-151
readupdate (supplementary)
file_des
is the descriptor denoting a file opened for alternate I/O.
buf
points to the string where readupdate stores the input message.
read_bytes
specifies the number of bytes to read.
write_bytes
specifies the number of bytes to write.
Return Value
depends upon the file type of file_des. When file_des refers to a disk file, readupdate
returns one of the following:
•
A positive value, which represents the number of characters read
•
The value zero, which indicates that no data was read because the file-position
indicator was at the end of the file
•
A negative value, which indicates that an error occurred
When file_des refers to the $RECEIVE file, readupdate returns one of the following:
•
A positive value, which represents the number of bytes read
•
A negative value, which indicates that an error occurred
Usage Guidelines
•
Updating a Disk File
You can use readupdate to read information at the file-position indicator (set by a
previous call to lseek). The readupdate function does not move the file-position
indicator. Consequently, you can overwrite (update) the information just read.
•
Reading an Interprocess Message from the $RECEIVE File
When the readupdate function reads the $RECEIVE file, the message read is a
request from another process or from the system. The program that calls readupdate
must interpret the request and then respond using reply. For information on
interpreting the $RECEIVE message and sending a reply, refer to “reply
(supplementary)” on page 3-154.
•
When a read of the $RECEIVE file sets errno to six, the message is a Guardian
system message.
•
When reading $RECEIVE, set errno to zero before calling readupdate.