Re: Failed to copy Resource Fork??
Re: Failed to copy Resource Fork??
- Subject: Re: Failed to copy Resource Fork??
- From: Uli Kusterer <email@hidden>
- Date: Sat, 30 Jul 2005 15:19:15 +0200
On Jul 30, 2005, at 14:48:30, darpan kamboj wrote:
FILE *fp;
fp = fopen(Audio 1_01,"wb+");
fwrite(DataBuff,SizeToSave,1,fp);
You really should be using Cocoa methods for writing your file. In
particular, use NSDocument, if it makes sense for your app.
NSDocument has a method to return an attributes dictionary that lets
you specify values for file type and creator. Search the list
archives for lots of sample code to even do that automatically based
on your Info.plist entries (I think I even posted my UKDocument
class's code once). You don't need a resource fork at all. You only
need to set the file's HFS attributes, which are actually separate
from that.
If you badly *need* to use fwrite() (which only accesses the data
fork), you'll have to use the File Manager (documented as part of
Carbon) to set the additional attributes. Make sure you use FSRefs to
refer to the file (you can create an FSRef from a path) and not the
old FSSpecs, though.
If all you're doing is copying files, you don't need all that. Just
use NSWorkspace or NSFileManager, both of which offer ways to copy a
file. Though they will only correctly copy along the resource fork of
a file on newer MacOS releases, IIRC. Check out the documentation at
developer.apple.com to be sure they're available for the system
version you're deploying to.
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden