Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!rpi!leah!tmm33
From: tmm33@leah.Albany.Edu (Terry McCoy)
Newsgroups: comp.unix.xenix
Subject: getc help needed
Message-ID: <2056@leah.Albany.Edu>
Date: 27 Sep 89 14:26:28 GMT
Reply-To: tmm33@leah.albany.edu.UUCP (Terry McCoy)
Distribution: usa
Organization: University at Albany, Computer Services Center
Lines: 25

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@leah.albany.edu
Phone:       (518) 442-4588
Snail Mail:  Terry McCoy ES-235
             SUNY Albany
             1400 Washington Ave.
             Albany, NY 12222