Re: [Array writeToFile:Path atomically:YES]
Re: [Array writeToFile:Path atomically:YES]
- Subject: Re: [Array writeToFile:Path atomically:YES]
- From: David Blanton <email@hidden>
- Date: Tue, 11 May 2004 20:09:57 -0600
On 5/11/04 6:00 PM, "Allan Odgaard" <email@hidden> wrote:
>
On 11. May 2004, at 23:20, David Blanton wrote:
>
>
> Does this imply that the array columns are not being interpreted as
>
> NSString* when in fact they are? Or, is there some Cocoa secret to
>
> writing
>
> an array to a file?
>
>
It could also mean that the file could not be created, e.g. because of
>
lack of permission or the containing directory.
>
>
You can do something like this to check which objects are in the array:
>
>
NSEnumerator* enumerator = [g_killListArray objectEnumerator];
>
while(id obj = [enumerator nextObject])
>
NSLog(@"%@", [obj class]);
>
>
Though IIRC writing out an array with non plist-items will just skip
>
those items.
Maybe I don't understand arrays well enough. To create an array of n rows
and m columns I do the following:
@interface KillList : NSObject
{
NSString *cap, *pin, *password, *actdate, *expdate;
}
// getters
- (NSString *)cap;
- (NSString *)pin;
- (NSString *)password;
- (NSString *)actdate;
- (NSString *)expdate;
//setters
- (void)setCap:(NSString *)newCap;
- (void)setPin:(NSString *)newPin;
- (void)setPassword:(NSString *)newPassword;
- (void)setActdate:(NSString *)newActdate;
- (void)setExpdate:(NSString *)newExpdate;
Then I make a new KillList object, set the ivars and add the KillList object
to the array. It is this array that I want to write to a file so I can read
it back and load an array when the program starts.
So, what is the Cocoa way to do this?
Thanks to all for the help so far!
_______________________________________________
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.