Can anyone tell me roughly how stat.st_size works in order to get the
size of the file? Does it read through the file and count the number
of bytes? Would this take time for a super large file?
This has nothing at all to do with C, and a whole lot to do with whatever
programming environment you're looking at.
Just an idle thought, though: If you had to read through a file and
count bytes to know how large it was, how exactly would directory listings
work? I'd guess that filesystems probably track that kind of information
internally.
-s
p.s.: There is an eerie similarity between this "st_size" member which
supposedly contains the "size" of a file, and one of the components of the
Unix "struct stat" data object, in which case perhaps a Unix newsgroup?
Remember that the system call will behave the same way if you access it
from perl, or Ruby, or FORTRAN, or anything else; it's a feature of the
operating system, not of th eprogramming language.