Re: NSString and writeToFile
Re: NSString and writeToFile
- Subject: Re: NSString and writeToFile
- From: Nick Zitzmann <email@hidden>
- Date: Mon, 22 Sep 2003 13:59:26 -0700
On Monday, September 22, 2003, at 12:41 PM, Miguel Nunes Correia wrote:
I'm writing a program that generates some text in NSString and I want
to save it into a file to a specific path chosen by the user. The
problem is that it gives me this error : "*** +[NSString
writeToFile:atomically:]: selector not recognized" and doesn't save
the file making application exit with status 0.
Here is where I call writeToFile:
table = [NSString writeToFile:filePath atomically:YES];
You're trying to call "writeToFile:" as if it was a class method, when
it is actually an instance method. So if you have a string named
"myString", then you would save it like this:
if ([myString writeToFile:filePath atomically:YES])
{
// if this spot is reached, then the file was saved at filePath
}
else
{
// if this spot is reached, then the file was not saved
}
Nick Zitzmann
AIM/iChat: dragonsdontsleep
Check out my software page:
http://seiryu.home.comcast.net/
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my
telephone." - Bjarne Stroustrup
_______________________________________________
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.