Re: writeToFile method of NSArray
Re: writeToFile method of NSArray
- Subject: Re: writeToFile method of NSArray
- From: Daniel Zitter <email@hidden>
- Date: Thu, 15 May 2003 09:53:43 -0700
Message: 9
From: "Parichay Gupta" <email@hidden>
To: <email@hidden>
Subject: writeToFile method of NSArray
Date: Thu, 15 May 2003 17:14:37 +0530
Hi,
In my Cocoa/Objective-C application, I have a NSArray of NSString
objects.
Whenever I'm trying to dump the content of the NSArray into a text
file using
its writeToFile method, the text file is getting created with the XML
format.
Can I simply dump the content line by line (instead of XML format)?
For example, the content of the text file needs to be like the
following
This is the first string of NSArray
This is the second string of NSArray
This is the third string of NSArray
...
TIA,
Parichay
Parichay,
The Foundation framework is your new friend.
NSArray *array = [NSArray arrayWithObjects:
@"This is the first string of NSArray",
@"This is the second string of NSArray",
@"This is the third string of NSArray",
nil];
[[array componentsSeparatedByString:@"\n"]
writeToFile:@"/tmp/myString.txt" atomically:YES];
Familiarity with NSArray and NSDictionary is essential to Cocoa
programming.
Being grounded in Foundation is absolutely worth the effort, 100%.
Dan
_______________________________________________
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.