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

Re: NSCoder question


  • Subject: Re: NSCoder question
  • From: Daniel DeCovnick <email@hidden>
  • Date: Thu, 18 Nov 2004 01:39:53 -0500

I'm not sure of the exact function, but somewhere in the Foundations functions documentation mentions detection and byte-swapping.

-Daniel DeCovnick
danhd123 AT mac DOT com
http://www.softyards.com/
On Nov 17, 2004, at 1:49 PM, Will Mason wrote:

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

_______________________________________________ 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
References: 
 >NSCoder question (From: Will Mason <email@hidden>)

  • Prev by Date: Re: How to embed a popup menu in an NSTextField
  • Next by Date: Replacing characters of a string
  • Previous by thread: NSCoder question
  • Next by thread: how to control AddressBook's auto-completion feature
  • Index(es):
    • Date
    • Thread