Re: writeToFile and arrayWithContentsOfFile
Re: writeToFile and arrayWithContentsOfFile
- Subject: Re: writeToFile and arrayWithContentsOfFile
- From: Bryan Blackburn <email@hidden>
- Date: Wed, 15 Jan 2003 01:25:34 -0700
- Mail-followup-to: email@hidden
arrayWithContentsOfFile: returns an autoreleased object, so if you need to
use the results later (which I'm guessing you are since you're loading
it into an object variable), you'll need to retain it:
PhoneBookData = [[NSMutableArray
arrayWithContentsOfFile:[@"~/PhoneBackup.txt
"stringByStandardizingPath]] retain];
Bryan
On Jan 14, 2003 22:03, Chuck Rice stated:
>
I am attempting to write an array to a file, then read it back in.
>
This seems to work the first time, but if I write, then read, then
>
write, it fails. I am a bit new at this, so I do not understand the
>
error I am getting. By logging the array, it looks like it writes it
>
out and reads it back in correctly. What am I missing. There is a
>
truncated portion of the Console Log following the code frag. -Chuck-
>
[snip]
>
>
- (IBAction)ReadBackup:(id)sender
>
{
>
PhoneBookData = [NSMutableArray
>
arrayWithContentsOfFile:[@"~/PhoneBackup.txt
>
"stringByStandardizingPath]];
>
NSLog(@"\r%@",PhoneBookData);
>
}
>
[el snippo]
_______________________________________________
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.