Re: Storing Instances of a structure in a file
Re: Storing Instances of a structure in a file
- Subject: Re: Storing Instances of a structure in a file
- From: Adil Saleem <email@hidden>
- Date: Sun, 21 Sep 2008 04:09:02 -0700 (PDT)
And what if the fields in structures are instances of Cocoa classes (like NSNumber etc) ?
--- On Sun, 9/21/08, Phil <email@hidden> wrote:
From: Phil <email@hidden>
Subject: Re: Storing Instances of a structure in a file
To: email@hidden
Cc: email@hidden
Date: Sunday, September 21, 2008, 3:57 AM
On Sun, Sep 21, 2008 at 9:13 PM, Adil Saleem <email@hidden>
wrote:
> Hi,
>
> I want to store instances of a structure in a file so that my application
can retreive them and read them.(Basically they are different configuration
presets for the application) I also want each instance that is stored to be
unique. I know this becomes a typical database problem but i don't want to
use database.
>
> Is there any Cocoa API that can help me with this problem ? I know it can
be done in plain C language, but that would be lengthy and error-prone. If there
is anything in Cocoa that can help me, it would be great.
>
If you're talking about plain-C structs then you can wrap them up in
NSValue or NSData instances, which you can then write out with an
NSCoder (or if you have lots of them, put them into an NSArray and do
the same).
Phil
_______________________________________________
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