getc help needed, using rdchk()
Conor P. Cahill
cpcahil at virtech.UUCP
Fri Sep 29 09:54:25 AEST 1989
In article <1166 at orbit.UUCP>, vemis at pnet51.orb.mn.org (Jeff Mo) writes:
> tmm33 at leah.Albany.Edu (Terry McCoy) writes:
> >Does anyone known what would be needed to create a function similar to getc()
> >that would return control to the calling function if the buffer was empty.
>
> Under SCO Xenix 2.2.x and 2.3.x, a call to rdchk(file_descriptor)
> will return a 1 if the process will not block on a read(),
> or if it's at EOF. To use:
> if (rdchk(file_des) > 0)
> read(file_des, buffer, nbytes);
O_NDELAY in the open() (or through an ioctl()) is preferred because it
does not require the extra overhead of an extra system call (the rdchk()).
In addition it is much more portable.
--
+-----------------------------------------------------------------------+
| Conor P. Cahill uunet!virtech!cpcahil 703-430-9247 !
| Virtual Technologies Inc., P. O. Box 876, Sterling, VA 22170 |
+-----------------------------------------------------------------------+
More information about the Comp.unix.xenix
mailing list