Re: File Size and long longs...
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.