On Mar 25, 2009, at 12:06 AM, Ricardo Balderas wrote:
I'm starting with a Cocoa Document Based project, but am having trouble with Opening and Saving of documents. The stump comments in MyDocument.m are beyond me still, and I've tried the "Building a Text Editor in 15 minutes" example, but the opening and saving documents part is a bit outdated and gets confusing. Could you help me with a simple and well explained sample code of how to Open and Save files? Also, how can I make the app save .txt or .rtf files? I managed to make it output .???? files and read them back, but trying to add other file types (taken from the TextEdit source code) led to problems reopening a saved file.
A document-based approach is probably not useful for your example. If you really want to get into file management in Cocoa, refer to the NSFile* classes. At this early stage, I wouldn't bother yet and just look at NSString's -initWithContentsOfFile:encoding:error: and - writeToFile:atomically:encoding:error: and the NSScanner class.
HTH, Keary Suska Esoteritech, Inc. "Demystifying technology for your home or business" _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com