In article <m31yqysf6c.fsf at atrus.jesus.cam.ac.uk>, Michael Hudson wrote: >grante at visi.com (Grant Edwards) writes: > >> In article <mailman.987030856.375.python-list at python.org>, Robin Thomas wrote: >> >> >sys.stdin is more like a pipe, and not a regular file. You >> >can't ask a pipe how many bytes it contains before you read >> >from it. >> >> Actually, you can. >> >> At least on some Unix systems, the FIONREAD ioctl() call will >> tell you how many bytes there are in a pipe waiting to be read. >> IIRC, it also works on some tty devices as well. Probably not >> very portable, and somebody could have shoved more bytes into >> the other end after the ioctl() and before the read(), so you >> could get more that you expect, but you shouldn't get less. > >That's interesting for a pet project of mine. How on earth does one >go about learning things like that? I learned it by reading Usenet and looking at device driver source code. >Is this sort of stuff in Stevens' APUE? Might be. I don't have a copy at hand. -- Grant Edwards grante Yow! He is the at MELBA-BEING... the ANGEL visi.com CAKE... XEROX him... XEROX him --
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4