• 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
FSSpec from NSString Problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FSSpec from NSString Problems


  • Subject: FSSpec from NSString Problems
  • From: Jonathan Sick <email@hidden>
  • Date: Sun, 26 Jan 2003 02:24:05 -0700

Hi,

In my cocoa app I'm using QuickTime, which requires that I use FSSpec. Based on a Cocoa Dev Central tutorial by Tom Waters (see http://cocoadevcentral.com/articles/000018.php), I found the following way to convert from my NSString filepath to FSSpec:

- (BOOL)makeFSSpec:(FSSpec *)specPtr fromPath:(NSString *)inPath {
FSRef fsref;

OSStatus status = FSPathMakeRef([inPath fileSystemRepresentation],&fsref, NULL);
if (status == noErr) {
status = FSGetCatalogInfo(&fsref, kFSCatInfoNone,NULL, NULL, specPtr, NULL);
} else {
NSLog(@"makeFSSpec error");
}
return status == noErr;
}

But when I compile this from within Codewarrior 8.3, I get an error that [inPath fileSystemRepresentation] returns a const char *, while the FSPathMakeRef wants an unsigned const char *. I tried casting to (unsigned const char *), and although this did compile, it printed out "makeFSSpec error" in runtime. I'm not sure if casting was the correct course of action, it just seemed like a natural remedy from my original background in Java.

I am sure that my NSString path is good, since I'm getting it directly from an NSSavePanel.

So my question is: how do I get this to work, how do I correctly provide FSPathMakeRef() the unsigned char pointer that it wants?

Thanks in advance,
Jonathan Sick

--
Jonathan Sick
email@hidden
http://homepage.mac.com/jonathansick/

Research is what I'm doing when I don't know what I'm doing.
-Wernher Von Braun
_______________________________________________
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.

  • Follow-Ups:
    • Re: FSSpec from NSString Problems
      • From: Rosyna <email@hidden>
  • Prev by Date: Re: cascading sheets and HIG
  • Next by Date: Re: FSSpec from NSString Problems
  • Previous by thread: getting key codes
  • Next by thread: Re: FSSpec from NSString Problems
  • Index(es):
    • Date
    • Thread