Re: Need help finding examples of read/writing files in Cocoa
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