0

I'm looking for this and I couldnt find anything to help me. I think it is simple, what i need to do is to show the shared folders in my network, using boost libraries.

For example

std::string dir = "/home/user";
for (boost::filesystem::directory_iterator it(dir), end; it!=end; it++)
    if (boost::filesystem::is_directory(*it))
        cout << it->path().filename().generic_string();

This shows me all folders in the path "/home/user". The question is, whats is the dir that i need to use to show my shared folders in my network? I try "\\", "\\my_pc_name", "\\Workgroup" but i have no idea and i don't know if i can do this in this way. Thanks.

Mad Dog Tannen
  • 7,129
  • 5
  • 31
  • 55
Safej
  • 73
  • 10

1 Answers1

0

I assume from your question that you're on Linux and the folders you're trying to access are on a Windows share. You can't access them directly -- you'll need to mount them using something like smbfs. See this answer for more.

Community
  • 1
  • 1
Christian Ternus
  • 8,406
  • 24
  • 39
  • Yes, i'm on Linux and trying to access on a Windows share, but i need too make this in Windows, but when i do this first. I'm looking for a way that works in Linux and Windows. Now i'm begining. Thanks for your answer, i'm seeing the link. – Safej Oct 27 '13 at 18:51
  • On Windows, you can access the path directly (or so [this link](http://www.cplusplus.com/forum/general/50546/) says, I don't have a Windows box handy). – Christian Ternus Oct 27 '13 at 18:52
  • I saw in the file `/proc/mounts` that there are the mounted drives. If i mount a shared folder i can use this path with boost::filesystem and it works. Exist any way to mount the shared folder and use it in this way? I saw the command `mount` in C++ `` but i dont know how to use it, and the system command `mount` need admin access to use it. – Safej Oct 28 '13 at 16:16
  • Sure. If you don't have root, try `smbnetfs`, as described here: http://askubuntu.com/questions/24348/how-do-i-mount-samba-share-as-non-root-user – Christian Ternus Oct 28 '13 at 16:17