RE: [Newbie] writing plain text to a file
RE: [Newbie] writing plain text to a file
- Subject: RE: [Newbie] writing plain text to a file
- From: "Jonathan E. Jackel" <email@hidden>
- Date: Fri, 28 Feb 2003 17:59:00 -0500
Strings can write themselves to files, too, so convert your array to a
string:
[[numArray componentsJoinedByString:@"\n"] writeToFile:numFileLocation
atomically:YES];
Jonathan
>
-----Original Message-----
>
From: email@hidden
>
[mailto:email@hidden]On Behalf Of Chris Garaffa
>
Sent: Friday, February 28, 2003 4:28 PM
>
To: email@hidden
>
Subject: [Newbie] writing plain text to a file
>
>
>
Hi all,
>
>
I've been programming Cocoa for a couple months now, but getting really
>
into it the last 2 or 3 weeks. I've got this program which generates a
>
random number in a specified interval, and writes that number, and the
>
next 100 or so numbers above it. It needs to write all these numbers to
>
a file, each on its own line. What I do now is create an NSMutableArray
>
to hold all the numbers, and then [numArray writeToFile:
>
numFileLocation atomically:YES]. This works... it creates the file and
>
the data is in there, but I (and my users!) would rather have just a
>
plain text file with one number on each line instead of this XML file.
>
I did some research and found a lot of stuff about NSFileHandle,
>
NSFileManager and NSData but I couldn't figure out the best way to do
>
this. Can someone point me in the right direction? Thanks!
>
>
--
>
Chris Garaffa
>
email@hidden
>
http://moondrop.heli0s.net/
>
_______________________________________________
>
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.
_______________________________________________
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.