A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/066917.html below:

how to calculate the size of sys.stdin?

how to calculate the size of sys.stdin?Michael Hudson mwh21 at cam.ac.uk
Thu Apr 12 04:19:55 EDT 2001
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?  Is this sort of stuff in Stevens'
APUE?

Cheers,
M.

-- 
  We did requirements and task analysis, iterative design, and user
  testing. You'd almost think programming languages were an interface
  between people and computers.                    -- Steven Pemberton
          (one of the designers of Python's direct ancestor ABC)

More information about the Python-list mailing list

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