writeToFile:
writeToFile:
- Subject: writeToFile:
- From: "Hussain Bandukwala" <email@hidden>
- Date: Mon, 17 Feb 2003 16:03:46 -0500
Hi All,
I've been experiencing problems with the writeToFile: method for the NSDictionary class. I would like to write a dictionary's contents to a .txt file. I've already created the required .txt file and placed in the folder of the application. I have also added the .txt file as a resource within the application through Project Builder. The following is the code that I am using:
// creating path
blockListDictPath = [[NSBundle mainBundle] pathForResource:@"BlockedDevicesList" ofType:@"txt"];
// creating dictionary
blockedDirectory = [NSDictionary dictionaryWithObject: connectToDevice forKey: deviceName];
// calling writeToFile
if ([blockedDirectory writeToFile:blockListDictPath atomically:YES])
{NSLog(@"Success Writing to File");}
else
{NSLog(@"Failure Writing to File");}
Irrespective of my using 'YES' and 'NO' values for atomically, I get failure in writing to the file.
Is it even possible to write a dictionary to a .txt file? Am I missing something? Any other suggestions for doing what I need to do?
Thanks for all your help.
Best Regards,
Hussain
========================================================================
Hussain H. Bandukwala,
C-1116, 1189 Beall Ave.,
The College of Wooster,
Wooster, OH - 44691.
(Home) -- (330)-287-3000 (x-7107)
(Cell) -- (330)-412-1980
http://pages.wooster.edu/hbandukwala
"They build too low who build beneath the skies."
-- an inscription on a building in Washington, D.C.
========================================================================
_______________________________________________
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.