getc help needed
Conor P. Cahill
cpcahil at virtech.UUCP
Thu Sep 28 11:20:49 AEST 1989
In article <2056 at leah.Albany.Edu>, tmm33 at leah.Albany.Edu (Terry McCoy) writes:
> I have looked at the getc function in the stdio.h header file and noticed that
> it calls a function _filbuf. I think that this function is located within the
> kernal and controls the pointers, flags and the counter within the structure
Nope. _filbuf is a stdio library function that eventually uses read(2) to
fill the buffer.
> FILE. Any information on how this function works or how I could tell if data
> has arrived at the serial port without waiting would be helpful.
Since you are reading data off of the serial port you should use the
following type of code:
#include <fcntl.h>
fd = open(TTY_PORT,O_RDWR+O_NDELAY....)
if( (cnt=read(fd,buffer,512)) > 0 )
/* process the data */
else if( cnt == -1 )
/* handle read failure */
/* else cnt = 0 (no data available) */
--
+-----------------------------------------------------------------------+
| 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