XbZ_FileAttrib2DosAttrib()
Previous  Top  Next

XbZ_FileAttrib2DosAttrib) - Convert File Attribute to DOS File Attribute.

Syntax

XbZ_FileAttrib2DosAttrib(<cFileAttrib>,  
                        [<lAsNumber>]) --> cDosAttrib | nDosAttrib  

Parameters

<cFileAttrib>  
<cFileAttrib> contains the File Attribute string that should be converted. Possible values are any combination of the following six letters: "SHARVD", or an empty string.  

<lAsNumber>  
<lAsNumber> optionally specifies if the return value should be a Number or a U2Bin()-converted String value. The default value of <lAsNumber> is .F. (FALSE), which means that this function normally returns a U2Bin()-converted String value, as it is used in Central Directory Records. If <lAsNumber> is set to .T. (TRUE), the return value will be a number, with the corresponding File Attribute Bits set.  

Returns

This functions returns the converted <cFileAttrib> either as a DOS_Attribute Byte value <nDosAttrib> -- if <lAsNumber> is .T. (TRUE) -- or the U2Bin()-converted string value <cDosAttrib> of that Byte -- if <lAsNumber> is .F. (FALSE) or not specified.  

Description

This functions converts the File Attribute String <cFileAttrib> to either a DOS_Attribute Byte value <nDosAttrib> or the U2Bin()-converted String value <cDosAttrib> of that Byte. The return value depends on the value of <lAsNumber> and defaults to <cDosAttrib>, as this is the value used in Central Directory Records. This Function is the reverse of the XbZ_DosAttrib2FileAttrib() function.  
 
NOTE: The supported File Attributes are ONLY valid for MS DOS and Windows (FAT/VFAT/NTFS)!  

Example

LOCAL cDosAttrib  := XbZ_FileAttrib2DosAttrib('ASH')  
LOCAL nDosAttrib  := XbZ_FileAttrib2DosAttrib('ASH', .t.)  
LOCAL cFileAttrib := XbZ_DosAttrib2FileAttrib(cDosAttrib, '-')  
QOut(cFileAttrib)        --> '-HS--A'  
QOut(str(nDosAttrib, 2)) --> '38'