in reply to Counting the size of STDIN
The traditional way that I would find the size of a file (apart from an existing function that would do it for me) is to:
The trouble with this, in the particular case of STDIN, is that such a filestream is usually a stream, and therefore not “positionable.” If it is a pipe (and you don’t know that until runtime), it has no set “size” at all. You just pump from it until the well eventually runs dry.