• 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 questions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File size questions


  • Subject: Re: File size questions
  • From: Peter <email@hidden>
  • Date: Fri, 16 Aug 2002 09:45:38 +0800

Thanks for your answer.

BTW sometimes I use stat() (man stat) to check file size similar to NSFileManager. I do a sizeof(off_t) and it is confirmed to 8 bytes in size (long long).

Funny off_t is typedef as signed long long,

snippet from <sys/types.h>

typedef u_int64_t u_quad_t; /* quads */
typedef int64_t quad_t;
typedef quad_t off_t; /* file offset */


Now I realized even lseek() is using 64 bit pointers.

Thanks again.

Peter.


On Friday, August 16, 2002, at 06:29 AM, Kirk Kerekes wrote:


On Thursday, August 15, 2002, at 11:13 AM, cocoa-dev-
email@hidden wrote:

Message: 11
Date: Thu, 15 Aug 2002 22:28:44 +0800
Subject: Help : File size questions
From: Peter <email@hidden>
To: email@hidden

Hello,

Recently stumble a very big file (about 3.3 GB), however I keep getting
incorrect file size. I supposed I have hit 32 bit signed int limit. By
looking the snippet below, how do I over come this problem.

fattrs = [fileMgr fileAttributesAtPath:pathStr traverseLink:YES];
filesize = [[fattrs objectForKey:NSFileSize] intValue];

A few questions,

1) On the doc. NSFileSize returns NSNumber, what is biggest number will
it hold ?


The largest _integer_ is a long long, which is 8 bytes. This can be inferred by looking at the NSNumber documentation, at the:

- (long long)longLongValue;
and
- (unsigned long long)unsignedLongLongValue;

-- methods. It may be a leap of faith to assume that the NSNumber returned for the NSFileSize attribute actually contains a long long, but it isn't a very big leap.

2) What is the biggest file size for HFS+ and UFS ?


The same as an unsigned-long-long NSNumber: 64 bits or "over 9 exabytes (2^
63 - 1)"

3) What about stat() function, does it return file size value greater
than 4 billion ( bigger than unsigned long) ?

Presumably. Don't know. Doesn't seem relevant.
_______________________________________________
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.

  • Prev by Date: Re: Table grid lines won't draw
  • Next by Date: Re: (Mis?)Usage of NSFileHandle(SOLVED)
  • Previous by thread: Re: (Mis?)Usage of NSFileHandle(SOLVED)
  • Next by thread: [ANN] PdfCompress 0.6b
  • Index(es):
    • Date
    • Thread