2

How can I check in C# whether a directory is shared? And is it done in C/C++ under Windows?

The directory is on the same PC!

Fred Foo
  • 355,277
  • 75
  • 744
  • 836
Aaaaaaaa
  • 2,015
  • 3
  • 22
  • 40

2 Answers2

3

As for C#: To check wether you can access (read access at least) a network share / unc path with the current logged in user, do a IO.Directory.Exists(@"\\YourUNCShare")

For C++:

Check out this question

There's also this MSDN article, using PathFileExists which should do for C.

Community
  • 1
  • 1
Alex
  • 7,901
  • 1
  • 41
  • 56
1

In C++/C# you can use the following windows API's NetShareEnum() and NetShareGetInfo()

Check MSDN for the details.

gnuanu
  • 2,252
  • 3
  • 29
  • 42