Guardian C Library Calls Reference Manual

read (supplementary)
3-150 128833Guardian TNS C Library Calls Reference Manual
Reference to Library Calls
read (supplementary)
The read function reads a number of bytes from a file opened for alternate I/O, storing
the input data in a buffer.
file_des
is the descriptor denoting a file opened for alternate I/O.
buf
points to the buffer where read stores the input data.
nbytes
specifies the number of bytes to be read from the file.
Return Value
is the number of bytes read or zero if read encounters the end of the file.
Example
This example reads 10 bytes from the file $a.b.c and writes them to the array named buf:
#include <fcntlh>
int filedes;
short status;
char buf[20];
short nbytes;
filedes = open("$a.b.c", O_RDONLY|O_BINARY);
nbytes = 10;
/* ... */
status = read(filedes, buf, nbytes);
readupdate (supplementary)
The readupdate function reads disk files (except Edit files) for update operations or reads
the $RECEIVE file for interprocess communication. These two different uses of
readupdate are discussed under “Usage Guidelines.
#include <fcntlh>
short read(int file_des, char *buf, short nbytes);
#include <fcntlh>
short readupdate(short file_des, char *buf, short read_bytes,
long write_bytes);