1

Is it possible to open files on Samba shares using C++ IO streams in Linux as transparently as on Windows using just UNC path (or similar) or do I always need some kind of 3rd party library?

If a 3rd party library is the only solution, what 3rd party libraries are there for Samba shares access?

wilx
  • 17,697
  • 6
  • 59
  • 114
  • 1
    [CIFS](https://wiki.samba.org/index.php/LinuxCIFS_utils) appears to be the go-to library to bring a Samba share to your filesystem. From there you can presumably pass the files to your programs. – Luc Danton Jul 08 '12 at 07:47
  • @Luc Danton, I can confirm that CIFS is the way to go, once you mount the CIFS filesystem it acts like any other file on your hard drive to your programs. You should post this as an answer. – OmnipotentEntity Jul 08 '12 at 11:12
  • Are you referring to just opening regular files as C++ IO streams, or about using things like NTFS file streams over SMB ?(http://msdn.microsoft.com/en-us/library/windows/desktop/aa364404%28v=vs.85%29.aspx) – jelmer Jul 08 '12 at 14:16
  • @jelmer: I am referring to C++'s `std::fstream`. – wilx Jul 08 '12 at 18:30

1 Answers1

1

It looks like you just want to mount the remote server using cifsfs (see "man mount.cifs"), and then access the files from the mount point you specified.

There is no way that you can explicitly specify a UNC path or anything like that directly to standard file system API (on top of which std::fstream operates).

jelmer
  • 2,405
  • 14
  • 27