• 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: Need help finding examples of read/writing files in Cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need help finding examples of read/writing files in Cocoa


  • Subject: Re: Need help finding examples of read/writing files in Cocoa
  • From: "John C. Randolph" <email@hidden>
  • Date: Wed, 30 Jan 2002 22:21:44 -0800

On Wednesday, January 30, 2002, at 03:36 PM, Greg Chapel wrote:

Most all of the cocoa examples supplied with PB on OS X only show how to
work with files that include the object file wrapper, encoding/decoding
followed by archiving/unarchiving. What I want to be able to do is use the
standard OpenFilePane UI to browse and select files then use my own custom
object methods to read and/or write to the selected file ultimately
encoding/decoding this data to/from my own custom object.

If you just want to get the raw bytes and take it from there, you can use NSOpenPanel to get the path, and then pass the path you get to an NSData method like +dataWithContentsOfFile: (or +dataWithContentsOfMappedFile: if the file in question is rather big.)

-jcr


John C. Randolph <email@hidden> (408) 974-8819
Sr. Software Engineer, Cocoa Evangelism
Apple Worldwide Developer Relations


References: 
 >Need help finding examples of read/writing files in Cocoa (From: "Greg Chapel" <email@hidden>)

  • Prev by Date: Re: status bar
  • Next by Date: Re: status bar
  • Previous by thread: Re: Need help finding examples of read/writing files in Cocoa
  • Next by thread: InputServer/Manager
  • Index(es):
    • Date
    • Thread