Re: [Array writeToFile:Path atomically:YES]
Re: [Array writeToFile:Path atomically:YES]
- Subject: Re: [Array writeToFile:Path atomically:YES]
- From: j o a r <email@hidden>
- Date: Tue, 11 May 2004 22:37:33 +0200
On 2004-05-11, at 21.32, David Blanton wrote:
>
Bool OK = [Array writeToFile:Path atomically:YES];
In ObjC you should begin variable names with lower case letters - at
least when communicating with other developers. Like this:
BOOL didWrite = [myArray writeToFile: aPath atomically: YES];
>
But, OK always returns false indicating that all columns of the array
>
are
>
not NSString*.
I don't think that's the assumption you should make. A couple of things
to check:
Is the array valid and non-nil? Is the path valid and accessible? It
needs to be a full path, not relative and not including any funny shell
characters like "~".
Something like this:
if ((myArray != nil) && ([myArray count] > 0))
{
if (aPath != nil)
{
if ([myArray writeToFile: aPath atomically: YES])
{
NSLog(@"Did write");
}
else
{
NSLog(@"Failed to write");
}
}
else
{
NSLog(@"Invalid path");
}
}
else
{
NSLog(@"Invalid array");
}
j o a r
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.