Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to know if file is read-only?
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00890787
Message ID:
00890817
Views:
20
Wonderful! Thanks a lot George.

>>Hi all,
>>
>>I use the GetFileAttributes Win32API function to get the file attributes. However, the return value is the sum of all the attributes. I know that Read-Only is equal to 1. Is there a quick way to MOD() out this value? For example:
>>
>>* myFile.txt attributes: Archive (32) , Read-Only (1)
>>GetFileAttribute('myFile.txt') && 33
>>*---------------------------------------------------------------------------
>>function GetFileAttribute(cFileName)
>>	if type('cFileName')!='C' or !file(cFileName)
>>		return -1
>>	endif
>>	DECLARE INTEGER GetFileAttributes IN WIN32API STRING @ lpFileName
>>	return GetFileAttributes(cFileName)
>>endfunc
>>
>
>It's not the sum, but rather the values being ORed. Use the BITAND() function to make this determination like this
* lnattribs are the attributes returned
>llreadonly = (BITAND(lnattribs, 1) # 0)
ramil
~~ learning to stand still
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform