DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

rdchk(S-osr5)


rdchk -- checks to see if there is data to be read

Syntax

cc ... -lx

int rdchk(fdes)
int fdes;

Description

rdchk checks to see if a process will block if it attempts to read the file designated by fdes. rdchk returns 1 if the process will not block when a read is attempted or if it is the end of the file (EOF). In this context, the proper sequence of calls using rdchk is:

   if(rdchk(fildes) > 0)
   

read(fildes, buffer, nbytes);

Diagnostics

rdchk returns -1 if an error occurs (for example, EBADF), 0 when the process will block if it issues a read and 1 if it is okay to read. EBADF is returned if a rdchk is used on a semaphore file or if the file specified does not exist.

See also

read(S-osr5)

Standards conformance

rdchk is not part of any currently supported standard; it is an extension of AT&T System V provided by the Santa Cruz Operation.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005