Re: File Size and long longs...
Re: File Size and long longs...
- Subject: Re: File Size and long longs...
- From: Wade Tregaskis <email@hidden>
- Date: Thu, 13 May 2004 11:46:09 +1000
ok heres the code which opens a file seeks to then end to retrieve the
file size:
Although an idiom I often see, you generally should *not* seek to the
end of the file to get the size, since this is not guaranteed to be a
no-op/constant time operation.
Well, to be fair, where would you see a FS these days that doesn't
operate in this manner? All the significant Unix/Linux FS's that come
to mind are i-node based. I'm not sure what HFS+ uses, but I'm sure
it's something similar (or at least B-tree based, iirc, which is still
good enough).
I suppose that one guy out their still using FAT might be screaming
blue murder, but really..
Although having said all this, it is of course ultimately a better
method to just retrieve the file's size directly. It's just not that
bad to fall back to the seeking method.
Wade Tregaskis (aim: wadetregaskis)
-- Sed quis custodiet ipsos custodes?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.