home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / next / programm / 7199 < prev    next >
Encoding:
Internet Message Format  |  1992-11-12  |  1.4 KB

  1. Path: sparky!uunet!ogicse!emory!swrinde!gatech!prism!xray.gatech.edu!cc100aa
  2. From: cc100aa@xray.gatech.edu (Ray Spalding)
  3. Newsgroups: comp.sys.next.programmer
  4. Subject: Re: Serial port communication difficulties
  5. Message-ID: <74621@hydra.gatech.EDU>
  6. Date: 12 Nov 92 22:29:46 GMT
  7. Article-I.D.: hydra.74621
  8. References: <1992Nov10.115012.29368@doug.cae.wisc.edu> <1992Nov11.091546.5251@urz.unibas.ch> <1992Nov11.224715.12841@cs.tu-berlin.de>
  9. Sender: news@prism.gatech.EDU
  10. Organization: Georgia Institute of Technology
  11. Lines: 20
  12.  
  13. In article <1992Nov11.224715.12841@cs.tu-berlin.de> marcel@opal.cs.tu-berlin.de (Marcel Weiher) writes:
  14. >If you want exact control over the serial lines, don't use buffered
  15. >I/O ( fopen,fclose,getchar,feof) but UNIX system calls like open,
  16. >write,read and:  ioctl().
  17.  
  18. Yes, and in particular:
  19.     int nchar;
  20.     ioctl(ttyfd,FIONREAD,&nchar);
  21. will place the number of characters "immediately" available
  22. to be read on the file descriptor "ttyfd" (which may be zero)
  23. into "nchar".
  24.  
  25. If you're using the appkit, you could alternatively use DPSAddFD
  26. to cause the kit to call your own function whenever characters are
  27. available to be read.  (I assume it just arranges calls ioctl,
  28. as above, for you whenever you go for a new event).
  29. -- 
  30. Ray Spalding, Office of Information Technology
  31. Georgia Institute of Technology, Atlanta Georgia, 30332-0715
  32. Internet: ray.spalding@oit.gatech.edu (NeXT Mail accepted)
  33.