• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Porting BASIC text mangling app to Objective-C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Porting BASIC text mangling app to Objective-C


  • Subject: Re: Porting BASIC text mangling app to Objective-C
  • From: Keary Suska <email@hidden>
  • Date: Thu, 26 Mar 2009 08:42:13 -0600

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 (email@hidden)

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:
This email sent to email@hidden


References: 
 >Porting BASIC text mangling app to Objective-C (From: Ricardo Balderas <email@hidden>)

  • Prev by Date: Re: Reading one line at a time using NSFileHandle
  • Next by Date: file system query
  • Previous by thread: Porting BASIC text mangling app to Objective-C
  • Next by thread: Newbie delegate question regarding NSTable willDisplayCell
  • Index(es):
    • Date
    • Thread