Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site datagen.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!cmcl2!rna!rocky2!datagen!meissner From: meissner@datagen.UUCP Newsgroups: net.unix Subject: Re: 4.2BSB Buffered I/O buffersize Message-ID: <18@datagen.UUCP> Date: Wed, 29-Jan-86 11:10:21 EST Article-I.D.: datagen.18 Posted: Wed Jan 29 11:10:21 1986 Date-Received: Sat, 1-Feb-86 20:32:43 EST References: <546@well.UUCP> Reply-To: meissner@datagen.UUCP (Michael Meissner) Organization: Data General (Languages @ Westborough, MA.) Lines: 28 Keywords: buffered I/o In article <546@well.UUCP> jayr@well.UUCP writes: >I've got a program that is having trouble getting input because of the >limitations of the input buffer for buffered i/o (about 256), I'm occasionally >getting myself into trouble. > >1) Is there a way to change the buffersize for reading input? >2) Is there a non-buffered way to do this? > >I want to read up to (and including) a carriage return (equivalent to gets). >Any ideas? Thanks in advance. #1 If you are using system V.2 (also in forthcoming ANSI std): setvbuf( FILE *stream, char *buf, int type, int size ); where: stream is FILE * you want to change the buffering on buf is either the buffer to use or NULL (malloc buffer) type is one of: _IONBF no buffering _IOLBF line buffer (output only I think) _IOFBF full buffer size is the buffer size to use If you are using BSD 4.[12]: setbuffer( FILE *stream, char *buf, int size ); #2 Use read instead of stdio. Michael Meissner, Data General