Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!mcsun!ukc!stl!agm From: agm@stl.stc.co.uk (Andrew G. Minter) Newsgroups: comp.unix.programmer Subject: Re: Read and write /dev/ttya? Message-ID: <3971@stl.stc.co.uk> Date: 23 Jan 91 10:07:32 GMT References: Sender: news@stl.stc.co.uk Reply-To: "Andrew G. Minter" Organization: STC Technology Limited, London Road, Harlow, Essex, UK Lines: 17 In the referenced article veit@du9ds3.uni-duisburg.de (Holger Veit) writes: >montnaro@spyder.crd.ge.com (Skip Montanaro) writes: >>The getc() just hangs. What am I doing wrong? >stdio does input and output buffering. If your answering device does not >deliver a Carriage return as a block limiter, your getc() call will wait >forever. Try including > setbuf(f,NULL); This surely depends on where the buffering is done. Most UNIX systems will, by default, do line buffering on tty input in the kernel. You may find it necessary to put the tty into CBREAK or RAW mode using an ioctl code. I have a deep mistrust of stdio. It seems that the "tricky bits" work *slightly* different on every UNIX box I come to and it's very hard to write portable code. It may be a better idea to keep to low level I/O when talking to a device. Andrew