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