Re: How do I get a files length



"Rikishi 42" <skunkworks@xxxxxxxxxxxxx> wrote in message
news:r1n9e5-s1m.ln1@xxxxxxxxxxxxxxxxxxxxxx
On 2008-04-25, Aaron Gray <ang.usenet@xxxxxxxxx> wrote:



"Rikishi 42" <skunkworks@xxxxxxxxxxxxx> wrote in message
news:0lh9e5-t8l.ln1@xxxxxxxxxxxxxxxxxxxxxx
On 2008-04-25, Aaron Gray <ang.usenet@xxxxxxxxx> wrote:

How do I get the length of a file, hopefully without moving the
current
position.

You can stat(2) ("man 2 stat") or fstat(2) ("man 2 fstat") the file.
The
st_size of the returned stat structure will identify the "total size,
in
bytes" of the file.

Thanks but is there a separate function not requiring a struct ?

Yes. Stat. rtfm allready.

Yeah, how ?

How what? To get the size, or to rtfm ?

Shame the API's so crappy. So is man compared to HTML too. I develop on
Windows as it is quicker has nicer APIs and tools then I have a job porting
what I have done to Linux and Mac OS X.

Yeah its simple but windows has a single function to get the size of an open
file. *nix has some god damb struct that is as bad as X Windows'es data
structures, all that for one value. Then I have to wrap the darn thing to
make a portable API for my app, where if it had been a single function call
returniing the size I could have used a #define.

Waste of time, please read all the fuuking manuals and rewite the API's
while you are at it !

Aaron


.



Relevant Pages

  • Re: How do I get a files length
    ... The st_size of the returned stat structure will ... Thanks but is there a separate function not requiring a struct? ... poor Aaron will have to upgrade his B compiler ... int main(int argc, char *argv) ...
    (alt.os.linux)
  • Re: [2.6 patch] NET_SCH_ATM doesnt need ipcommon.o
    ... a single function). ... Let's get rid of that crap. ... struct br2684_vcc *brvcc; ... br2684_push(atmvcc, skb); ...
    (Linux-Kernel)