Re: Saving a NSMutableArray into a plain ASCII file
Re: Saving a NSMutableArray into a plain ASCII file
- Subject: Re: Saving a NSMutableArray into a plain ASCII file
- From: Marcel Weiher <email@hidden>
- Date: Wed, 29 May 2002 00:06:07 +0200
On Tuesday, May 28, 2002, at 11:48 Uhr, Frank Blome wrote:
- (IBAction) saveFile:(id)sender
{
NSString *configFile;
configFile = [NSString stringWithString:@"~/myfile.txt"];
configFile = [configFile stringByExpandingTildeInPath];
[contents writeToFile:configFile atomically:YES];
}
This works fine, but the result is a XML-Format, which is obviously
right,
since "contents" is an Array. But I need the file back in a standard
UNIX format (linefeed at the end and so on). Unfortunately I did not
found any method in the documentation which put my Array (actually a
NSMutableArray)
into a NSString. I search for this method, because I believe this is
the way to save it. If not, feel free to advise me.
Have you tried
[[contents componentsJoinedByString:@"\n"] writeToFile:configFile
atomically:YES]
?
Marcel
--
Marcel Weiher Metaobject Software Technologies
email@hidden www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.
_______________________________________________
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.