4.2BSB Buffered I/O buffersize

Kenneth Almquist ka at hropus.UUCP
Fri Jan 31 11:01:29 AEST 1986


> 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.

I assume that you are reading from a terminal.  In this case, the
problem is that the terminal driver will only buffer 256 characters.
Since the terminal driver will not pass any characters back to your
program until a carriage return is typed, if you type more than 256
characters without typing a carriage return you will hit this limit.

The limit can be changed by changing a constant in the kernel and
rebuilding your operating system.  The alternative to this is to set
CBREAK mode on your tty using the stty system call; this will cause
the characters to be passed to your program as they are typed.  When
you are in CBREAK mode the driver will not perform normal erase and
kill processing for the simple reason that the driver cannot delete
input that it has already passed to your program.  Thus you will have
to implement erase and kill processing in your program if you need it.
				Kenneth Almquist
				ihnp4!houxm!hropus!ka	(official name)
				ihnp4!opus!ka		(shorter path)



More information about the Comp.unix mailing list