how to get information about file  
Author Message
Puru





PostPosted: Visual FoxPro General, how to get information about file Top

hi all,

I m in need of your help, please suggest me any solution to my problem,.

I want to know whether Current user has write access to a particular file or not.

"Adir() function" and "GetFileAttributesEx" shows that file is read only or not. but if the access of that file is not given to current user then the file is not in readonly mode but if user try to access that file it shows access denied, i want to know this programatically, how can i get info whether access of the file is restricted to current user or not.

regards

purushottam



Visual FoxPro1  
 
 
CetinBasoz





PostPosted: Visual FoxPro General, how to get information about file Top

At the winAPI level you can find details under "CreateFile" topic. However if you don't need extreme details and just want to know if you could write to it or not you might try lowlevel function fopen() and check ferror() in case it doesn't return a valid handle.
 
 
MarciaAkins





PostPosted: Visual FoxPro General, how to get information about file Top

i want to know this programatically, how can i get info whether access of the file is restricted to current user or not.

You do not say which version of VFP you are using, but if you are using version 8 or later, you could wrap the attempt to use the file in a TRY / CATCH and if it fails examine the error.