4.2BSB Buffered I/O buffersize

meissner at datagen.UUCP meissner at datagen.UUCP
Thu Jan 30 02:10:21 AEST 1986


In article <546 at well.UUCP> jayr at 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



More information about the Comp.unix mailing list