• 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: Philippe Mougin <email@hidden>
  • Date: Thu, 13 May 2004 02:36:25 +0200

> ok heres the code which opens a file seeks to then end to
> retrieve the file size:
[...]
>
> NSNumber *totalFileSize = [NSNumber
> numberWithUnsignedLongLong:[fh seekToEndOfFile]];
[...]
> NSLog(@"%@ - %d",file,totalFileSize);
>
> this is what is output in the log
> 2004-05-12 16:01:43.524 Rebuild Utility[1154]
> ABPerson.index - 3313088
>
> the file's size in the finder is - 392 KB - 401,408 bytes
>
> whats up? any help?

Seems you gave a wrong format character for the totalFileSize argument in the format string passed to NSLog(). Should be %@ instead of %d, since totalFileSize is an object (i.e., an NSNumber).

Beside, you should avoid using NSNumber with unsigned values. NSNumber does not work reliably with unsigned types.

Best,

Philippe Mougin
--
F-Script: http://www.fscript.org
The open source scripting layer for Cocoa
_______________________________________________
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: Behavior of NSTextView scrollRangeToVisible
  • Next by Date: Re: File Size and long longs...
  • Previous by thread: Re: File Size and long longs...
  • Next by thread: How do I choose a network port for listening/broadcasting? (REPOST)
  • Index(es):
    • Date
    • Thread