Re: Question about NSFileHandle class
Re: Question about NSFileHandle class
- Subject: Re: Question about NSFileHandle class
- From: Andrew Farmer <email@hidden>
- Date: Sat, 30 May 2009 00:31:02 -0700
On 30 May 2009, at 00:14, Graham Cox wrote:
On 30/05/2009, at 5:09 PM, Adil Saleem wrote:
Does the class NSFileHandle implements endianness checks or is it
the responsibility of the programmer? I am using its method -
(NSData *)readDataOfLength:(NSUInteger)length
I want to read binary data from files and i want it to be same
every time in my application (no endianness issues) whether it is
an Intel based Mac or PPC based Mac. If NSFileHandle does not
implement these checks itself, then please suggest some other Cocoa
method that does it automatically.
It's your responsibility. It's not possible to hide endian issues
for an arbitrary binary file, because there is no way to know what
its contents represent.
Moreover, NSData is endian-neutral - it's just a bag of bytes. Endian
issues only appear when you impose an interpretation on those bytes.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden