Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8354199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:28:55+00:00 2026-06-09T09:28:55+00:00

In a Carbon app I need to convert an HFS style MacOS path into

  • 0

In a Carbon app I need to convert an HFS style MacOS path into a POSIX one that can be used in an fopen() call. For example:

my Vol:myFolder:myFile.jpg

to something like:

/my Vol/myFolder/myFile.jpg

If my Vol is my sytem disk, /myFolder/myFile.jpg works just fine, but if it’s on a different volume, it does not work (ie. my Vol/myFolder/myFile.jpg fails.

How to I specify the volume here?

Thanks!

Bill

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T09:28:56+00:00Added an answer on June 9, 2026 at 9:28 am

    An approach that avoids hard-coding (consider a volume not mounted in /Volumes/, such as a manually mounted one.)

    CFStringRef myHFSPath = CFSTR("Macintosh HD:Some Folder:Some Subfolder:Some File");
    
    CFURLRef url = CFURLCreateWithFileSystemPath(NULL, myHFSPath, kCFURLHFSPathStyle, FALSE);
    if (url) {
        UInt8 posixPath[PATH_MAX * 2]; /* Extra-large because why not? */
        if (CFURLGetFileSystemRepresentation(url, TRUE, posixPath, sizeof(posixPath)) {
            /*
                posixPath now contains a C string suitable for passing to BSD and
                C functions like fopen().
            */
        }
        CFRelease(url);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm converting a Carbon app to a Cocoa app and I can't find the
Is there any Carbon/Cocoa/C API available on Macs that I can use to enumerate
I need to translate the a carbon method into cocoa into and I am
How can I get a tabbed interface in carbon emacs which corresponds to one-tab-per-buffer
It used to be that in Carbon you could use SetMenuItemKeyGlyph. What's the alternative
For my app I need to use the Carbon file manager API to get
I'm currently coding an app that has hotkey functionality, I've done some reading and
I get the impression that Carbon Human Interface Toolbox does not work in 64-bit
C-h is correctly interpreted has 'help' in Carbon Emacs.app and using /usr/bin/emacs in Terminal.app.
Working on an application that contains legacy Carbon code (mixed with some Cocoa). It

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.