select()/stdio usage problem

S Johal ssj at castle.ed.ac.uk
Sat Feb 3 01:51:14 AEST 1990


I have an application that is event driven. I use select (- actually
I use XtAddInput form X Toolkit Intrinsics stuff). That tells me if
any input has arrived. I then use stdio.h gear to read from the
descriptor.

I read 'units' of information using stdio, the number of units arriving
being an unknown integer number. My problem is that I could not find any
stdio function that would do the equivilant of select - ie. as sort of 
"is there any more data left to be read ? - without actually reading it".

So, what I did was look at stdio.h, and decided to use FILE->_cnt, to
tell me if there are any items left in the buffer pool.

The questions I need help with, are:
  (1) Is it *totally* portable/POSIX compatible to use _cnt ?
  (2) if not, Have I missed something in stdio.h that will let me
      do what I'm after ?

*-------------------------------------------*----------------------------*
*  Subindrao Johal,                         *++++++++++++++++++++++++++++*
*  SARI Project,                            *  tel:   031 668 1550 x219  *
*  Department of Electrical Engineering,    *  fax:   031 662 4678       *
*  University of Edinburgh,                 *  email: ssj at sari.ed.ac.uk  *
*  The King's Buildings, Edinburgh EH9 3JL  *++++++++++++++++++++++++++++*
*-------------------------------------------*----------------------------*



More information about the Comp.unix.questions mailing list