home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / unix / question / 13632 < prev    next >
Encoding:
Internet Message Format  |  1992-11-19  |  1.4 KB

  1. Xref: sparky comp.unix.questions:13632 comp.unix.aix:11733
  2. Path: sparky!uunet!gatech!destroyer!gumby!wupost!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!rutgers!igor.rutgers.edu!gauss.rutgers.edu!manmetha
  3. From: manmetha@gauss.rutgers.edu (Rajesh Malhotra)
  4. Newsgroups: comp.unix.questions,comp.unix.aix
  5. Subject: Non blocking reads from stdin
  6. Keywords: non blocking getchar()
  7. Message-ID: <Nov.19.11.24.21.1992.26240@gauss.rutgers.edu>
  8. Date: 19 Nov 92 16:24:22 GMT
  9. Followup-To: comp.unix.aix
  10. Organization: Rutgers Univ., New Brunswick, N.J.
  11. Lines: 32
  12.  
  13.  
  14. Fellow Netters,
  15.  
  16.     How would I do a nonblocking read on stdin.
  17.  
  18. i.e have getchar() to be nonblocking in case there is no input.
  19. I can implement this by having an alarm go off after a timeout and then
  20. continue. 
  21.  
  22.     But is there an ioctl command that would do non-blocking i/o?
  23. I tried
  24.  
  25.     ioctl(fileno(stdin), FIOBNIO, 0)
  26.  
  27. but it does not like the FIONBIO command and I get an EINVAL errno.
  28. Any insight on this matter?
  29.  
  30. BTW, I am running AIX 3.2 on an IBM RS6000.
  31.  
  32. Any and all responses would be greatly appreciared.
  33.  
  34. Thanx,
  35.  
  36. Raj.
  37. -- 
  38. ===============================================================================
  39.   __  __     .
  40.  /   __/    /                               Raj Malhotra.
  41. /   ( /_   /                                voice : (908)613 4313. 
  42.         __/                                 email : manmetha@gauss.rutgers.edu
  43.  
  44. ===============================================================================
  45.