|Keep It Simple, Stupid|
Re: STDIN inheritance during exec and difference between getc and sysreadby BrowserUk (Pope)
|on Feb 25, 2013 at 20:14 UTC||Need Help??|
getc is buffered IO. The first call to a buffered IO call causes a full buffer of data -- 4096 bytes or as much as is available -- to be read from the device into the buffer. Then, in the case of getc(), just the first character of that input is returned to the caller. Subsequent calls to getc() return their data from that buffer.
Sysread on the other hand only reads as much as is requested from the device. Subsequent sysreads need to go back to the device for more.
The implication of your findings is that whilst the filehandle is shared across exec; the buffers used by buffered IO are not. Which is probably as it should be.
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.