getc help needed

Terry McCoy tmm33 at leah.Albany.Edu
Thu Sep 28 00:26:28 AEST 1989


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.

My application running SCO XENIX 2.3 has opened a serial port and monitors it
for incoming data.  The data is coming as packets.  I have tried using the
system functions getc, fread and read but they all wait for data to arrive
before returning control back to the calling function.

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
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.


Terry McCoy
SUNY Albany National Lightning Detection Network
Research Foundation  -  State University of New York at Albany
------------------------------------------------------------------------------
internet:    tmm33 at leah.albany.edu
Phone:       (518) 442-4588
Snail Mail:  Terry McCoy ES-235
             SUNY Albany
             1400 Washington Ave.
             Albany, NY 12222



More information about the Comp.unix.xenix mailing list