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 719041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:35:49+00:00 2026-05-14T05:35:49+00:00

Currently when I open a file with my program I can select files on

  • 0

Currently when I open a file with my program I can select files on a server by clicking on the server name in the sidebar in an NSOpenPanel and then selecting the file. No problem, this works fine for using the file as long as the shared directory is mounted. I get a path like “/Volumes/SHARENAME/filename.bla”.

My question is how do I get the server hostname of the computer it came from. For instance, if I clicked on the device with name SERVERNAME under “Shared” in the NSOpenPanel how do I get SERVERNAME from “/Volumes/SHARENAME/filename.bla”.

I have looked at quite a bit of documentation and have been unable to find a solution for this problem.

Any help toward this will be greatly appreciated. Thank you.

  • 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-05-14T05:35:50+00:00Added an answer on May 14, 2026 at 5:35 am

    This is not an Objective-C way of doing this but sometimes using popen(..) can get let you grab information you can parse from a unix command.

    Example

    #include <stdio.h>
    #include <string.h>
    
    int main() {
      FILE *fp = popen("df", "r"); // see man page for df
      if (fp) {
        char line[4096];
        while (line == fgets(line, 4096, fp)) {
          if (strstr(line, "/Volumes/SHARENAME")) { // You need the mount point
            char host[256];
            sscanf(line, "%s", host);
            printf("Connected: %s\n", host);
          }
        }
        pclose(fp);
      }
      return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to determine if a text file is currently open in
I'm currently using std::ofstream as follows: std::ofstream outFile; outFile.open(output_file); Then I attempt to pass
I'm currently installing and configuring an open source project on a test server. I've
I currently mantain an open-source project hosted in SourceForge. My project is written in
I am currently writing an open source wrapper for a COM object. I have
I am currently thinking about open-sourcing a project of mine and am in the
I'm currently developing (another) Open Source CMS in PHP and I'd like to use
Currently when I build my site I have to manually open validate it at
I am currently investigating several free/open source OpenGL based 3D engines, and was wondering
I don't currently use ajax.net though I would be open to it if 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.