### Question 19.2

How can I find out if there are characters available for reading (and if so, how many)? Alternatively, how can I do a read that will not block if there are no characters available?

These, too, are entirely operating-system-specific. Some versions of curses have a `nodelay` function. Depending on your system, you may also be able to use ``nonblocking I/O'', or a system call named `select` or `poll`, or the FIONREAD ioctl, `c_cc[VTIME]`, or `kbhit`, or `rdchk`, or the O_NDELAY option to `open` or `fcntl`. See also question 19.1.

Read sequentially: prev next up top

This page by Steve Summit // Copyright 1995 // mail feedback