• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: File Size and long longs...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >File Size and long longs... (From: email@hidden)
 >Re: File Size and long longs... (From: Allan Odgaard <email@hidden>)

  • Prev by Date: How do I choose a network port for listening/broadcasting? (REPOST)
  • Next by Date: Re: Unsigned Long Long
  • Previous by thread: Re: File Size and long longs...
  • Next by thread: Re: File Size and long longs...
  • Index(es):
    • Date
    • Thread