• 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: FSSpec --> OSX Path NSString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FSSpec --> OSX Path NSString


  • Subject: Re: FSSpec --> OSX Path NSString
  • From: Nick Zitzmann <email@hidden>
  • Date: Wed, 12 Mar 2003 04:26:07 -0800

On Wednesday, March 12, 2003, at 03:37 AM, Flemming Bengtsson wrote:

I'm writing an application that needs to convert an OS9 FSSpec structure to an OSX path NSString.
I can't see anyway to do this, hope I'm wrong...

You are. <;*) Here's the upshot (note: typed in Mail, untested, use at your own risk, etc.):

FSSpec spec;
FSRef ref;
NSString string;
char cString[PATH_MAX]; // to get PATH_MAX, include limits.h
OSStatus err;

if ((err = FSpMakeFSRef(&spec, &ref)) == noErr) // translate the FSSpec into an FSRef
{
FSRefMakePath(&ref, cString, PATH_MAX); // translate the FSRef into a path
string = [NSString stringWithUTF8String:cString]; // translate the C string into an NSString
}

If err is noErr, then "string" should hold the path...

Nick Zitzmann
AIM/iChat: dragonsdontsleep
Check out my software page: http://dreamless.home.attbi.com/

Smile! It confuses people!
_______________________________________________
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: Is it 'wrong' to use a global dictionary?
  • Next by Date: NSSlider in an NSToolbar problems
  • Previous by thread: FSSpec --> OSX Path NSString
  • Next by thread: Re: FSSpec --> OSX Path NSString
  • Index(es):
    • Date
    • Thread