• 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: Open Resource File with Cocoa Path
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Open Resource File with Cocoa Path


  • Subject: Re: Open Resource File with Cocoa Path
  • From: Rainer Brockerhoff <email@hidden>
  • Date: Wed, 10 Apr 2002 22:12:34 -0300

>Date: Wed, 10 Apr 2002 13:54:21 -0500
>From: Donald Brown <email@hidden>
>
>I need to be able to import data from a legacy file, and it includes some
>data in a resource. Anyone have any code to open a resource file?
>
>As near as I can tell, I have to parse the path myself, calling
>FSMakeFSRefUnicode on each portion to build up an FSRef, which I pass to
>FSpOpenResFile. It can't be that screwy, can it?

It's not. Do something like this:

FSRef ref;
NSString* theFilePath; // put your full path into this
if (FSPathMakeRef([theFilePath fileSystemRepresentation,&ref,NULL)==noErr) {
short res = FSOpenResFile(&ref,fsRdPerm);
if (ResError()==noErr) {
// now use the routines in Resources.h
// to read resources...
CloseResFile(res);
}
}

HTH,

--
Rainer Brockerhoff <email@hidden>
Belo Horizonte, Brazil
"I love deadlines. I love the whooshing noise they make as they go by" (Douglas Adams)
http://www.brockerhoff.net/ (updated Feb. 2002)
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: AppleScipt & Cocoa, argh! I can't get it to work
  • Next by Date: Frameworks included in bundles (NOT Applications)???
  • Previous by thread: RE: Open Resource File with Cocoa Path
  • Next by thread: Re: Open Resource File with Cocoa Path
  • Index(es):
    • Date
    • Thread