hidden & system files.

BlitzMax Forums/BlitzMax Programming/hidden & system files.

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

SuperStrict

Extern "WIN32"
	Function GetFileAttributes:Int(lpFileName:Byte Ptr)="GetFileAttributesA@4"
EndExtern

Function GetFileAttribs:String(FileName:String)
	Local s:String
	Local Mode:Int=GetFileAttributes(String.FromCString(FileName))
	If Mode &     1 =     1 s:+"R" ' Read only
	If Mode &     2 =     2 s:+"H" ' Hidden
	If Mode &     4 =     4 s:+"S" ' System
	If Mode &    16 =    16 s:+"D" ' Directory
	If Mode &    32 =    32 s:+"A" ' Archive
	If Mode &    64 =    64 s:+"$" ' device$
	If Mode &   256 =   256 s:+"T" ' Temporary
	If Mode &   512 =   512 s:+"P" ' Sparse
	If Mode &  1024 =  1024 s:+"L" ' Link
	If Mode &  2048 =  2048 s:+"C" ' Compressed
	If Mode &  4096 =  4096 s:+"O" ' Offline
	If Mode &  8192 =  8192 s:+"X" ' not indeXable
	If Mode & 16384 = 16384 s:+"E" ' Encrypted
	If Mode & 65536 = 65536 s:+"V" ' Virtual
	Return s
EndFunction

Print GetFileAttribs("testfile.txt")

Note that there are no \ chars in the external function definition, the code tag of this forum is just bugged and creates those.