0

How can I open a network shared file in OSX? I tried with and without "cifs:". also tried "192.168.xxx.xxx" but not working. thanks.

const std::string path_name("cifs://netshare.local/data/config.txt");

std::ifstream file( path_name.c_str(), std::ios::binary );

if (file.is_open())
{
    file.close();
    return true;
}
else
{
    // program comes in here
    return false;
}
John Zwinck
  • 239,568
  • 38
  • 324
  • 436
kc2
  • 207
  • 3
  • 12
  • Try finding a path that works in the terminal first. Can you say `ls -l cifs://netshare.local/data/config.txt` and see the file? – John Zwinck Jan 08 '15 at 02:30

1 Answers1

0

Paths to network shares mounted on Mac OS X appear under /Volumes, just like any other removable disk or disk image. If the share is called "data", it'll usually be mounted at /Volumes/data, but may end up at another path if that one isn't available.

(There's no way to directly access files on network shares that aren't mounted. So do that first.)

  • Thanks. That's the answer I need: "no way to directly access files on network shares". – kc2 Jan 08 '15 at 18:19
  • Note the qualifier: "…network shares **that aren't mounted**". It's perfectly possible once the share is mounted. –  Jan 08 '15 at 18:39