Xref: utzoo comp.sys.hp:4378 comp.lang.c:26101 Path: utzoo!attcan!uunet!cs.utexas.edu!usc!snorkelwacker!paperboy!meissner From: meissner@osf.org (Michael Meissner) Newsgroups: comp.sys.hp,comp.lang.c Subject: Re: Unbuffered Stdio Input Message-ID: Date: 20 Feb 90 16:31:04 GMT References: <378@node17.mecazh.UUCP> Sender: news@OSF.ORG Organization: Open Software Foundation Lines: 27 In-reply-to: paul@mecazh.UUCP's message of 19 Feb 90 22:29:29 GMT In article <378@node17.mecazh.UUCP> paul@mecazh.UUCP (Paul Breslaw) writes: | I have a little program that opens a master side pty and reads from it. | I have another little program that opens the corresponding slave side | and writes to it. | | If the master side is coded something like:- | | FILE *f; | char buf[ BF ]; | int nr; | | f = fopen( master, "a+" ); | nr = fread( buf, sizeof( char ), BF, f ); | | then the program hangs on the fread. Fread will loop attempting to fill the entire buffer. If your records are line oriented, I would recomend using fgets. If you need to get the characters as soon as possible, I would recomend switching the pty to CBREAK or RAW modes, and using getc() to read bytes as you need them. -- Michael Meissner email: meissner@osf.org phone: 617-621-8861 Open Software Foundation, 11 Cambridge Center, Cambridge, MA Catproof is an oxymoron, Childproof is nearly so