pgubook-readers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pgubook-readers] Question on Chapter 5, BUFFER SIZE of STDIN


From: Mark Schmid
Subject: [Pgubook-readers] Question on Chapter 5, BUFFER SIZE of STDIN
Date: Sun, 23 Sep 2007 18:46:28 +0200

Hi all,

A Question on Chapter 5, BUFFER SIZE of STDIN.

After re-installing Slackware 9.1 I am finally 
able to compile and run "toupper" in chapter 5.
Now I'm "using the concepts" where it says the
program should be modified to use STDIN and
STDOUT instead of input and output files and
to also modify the BUFFER_SIZE.

I did that and here a question comes up (I hope it's 
not answered in the rest of the book is it?) - Sorry 
for wanting to know *everything*:

I modified the BUFFER_SIZE to be 1 instead
of 500. But the funny thing is, I can input
an unlimited number of characters to STDIN
(the keyboard) and they will ALL be processed
and output as UPPERCASE to the screen as soon
as I hit the ENTER key, not just 1 or whatever
the size I set the buffer to.
Why is this?

Why does the STDIN file descriptor NOT consider
the buffer size limit *I* have specified???
Why does it suck in ALL input and ONLY transfer
input once you hit the ENTER key, instead of
transfering the input when the buffersize is
reached like when reading from a file on the
hard disk?
And how does it know to stop reading when you
hit the enter key? - But that's another question
perhaps...?

Am I missing something?
Did anyone else "Use The Concepts" of chapter
5 and make the same experience?

Regards,
Mark

-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer




reply via email to

[Prev in Thread] Current Thread [Next in Thread]