• 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: Saving a NSMutableArray into a plain ASCII file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Saving a NSMutableArray into a plain ASCII file
      • From: Frank Blome <email@hidden>
References: 
 >Saving a NSMutableArray into a plain ASCII file (From: Frank Blome <email@hidden>)

  • Prev by Date: Saving a NSMutableArray into a plain ASCII file
  • Next by Date: Re: Saving a NSMutableArray into a plain ASCII file
  • Previous by thread: Saving a NSMutableArray into a plain ASCII file
  • Next by thread: Re: Saving a NSMutableArray into a plain ASCII file
  • Index(es):
    • Date
    • Thread