On Fri, 2007-05-25 at 13:41 -0700, yazwas wrote:
> Hello,
> I'm trying to write a cross platform directory lister and copier,
> using standard C/C++, I'm using MinGW under windows, and I'm trying to
> use access() function to get file/dir permission, but it does not
> work, I'm getting ok all the time, my code is something like this
> if(access(dir, X_OK) != 0)
>             ...... do something,
> 
> but it never gives -1, its always 0 even for directories I don't have
> permission to,

I'm not sure how the windows handles the X-bit. Does the windows refuse
to let you search the directory if you don't have sufficient permission?

Try to call the function with R_OK or W_OK and see what will happen.
Anyway, you'll need to read the directory, since you're copying it, so
replace the check X_OK with R_OK.

> does anyone has any idea why is this happening under windows, for
> linux its ok, but windows its another story,
> 
> thankx in advance,

It might be the case with windows that users always have the right to
search a directory even if they don't have the sufficient permission to
read it.

> _______________________________________________
> help-gplusplus mailing list
> help-gplusplus@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gplusplus



_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to