NSCoder question
NSCoder question
- Subject: NSCoder question
- From: Will Mason <email@hidden>
- Date: Wed, 17 Nov 2004 10:49:23 -0800 (PST)
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
I'm confused about proper usage of NSCoder. Here's the problem. I want
to encode/decode an array of "unsigned long" values. The problem is
that I can't make identical keyed and unkeyed archives. For example, to
encode the array to an unkeyed archive I just call [NSCoder
encodeArrayOfObjCType: @encode(unsigned long) count: numberOfWords at:
&myArray]. Easy enough.
However, to put the array into a keyed archive my only choice really
(without creating a new key for every element of the array) is [NSCoder
encodeBytes: &myArray length: sizeof(unsigned long) * numberOfWords
forKey: @"words"]. This hardly works, as now I cannot decode the array
on a machine of different endianness. For example, if I want to read
the archive on an i386 Linux box running GNUstep, I'm stuck, as the
values of the array will all have the wrong endianness.
In neither case can I read the archive on a machine that has a
differently sized "unsigned long" than the machine that writes the
archive.
Does anyone know how to create an archive that doesn't leave me hanging
in terms of endianness?
Thanks for any help,
Will
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden