Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to know if file is read-only?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00890787
Message ID:
00890817
Vues:
19
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform