it seems the "kill" cmd in liberty basi doesent work because files are interpreted as read only when trying to "kill" them. I tried making a un-install program with the kill cmd, but it didn't work. What to to?
:confused:
The file delete command (like KILL) cannot delete read only files. You will probably need to use a function the Windows API to set the read only flag to false.
SetFileAttributesA looks like the right one.
Here's a short example:
FileDialog "Select filename", "*.*", file$
Call ClearReadOnly file$
End
Sub ClearReadOnly File$
CallDLL #kernel32, "GetFileAttributesA", _
File$ As Ptr, _
attr As Long
If attr <> -1 Then ' check for valid file
If (attr And _FILE_ATTRIBUTE_READONLY) = 1 Then
attr = attr - _FILE_ATTRIBUTE_READONLY
CallDLL #kernel32, "SetFileAttributesA", _
File$ As Ptr, _
attr As Long, _
ret As Long
End If
End If
End Sub
-Carl Gundel, author of Liberty BASIC
Liberty BASIC - Easy Programming for Windows (http://www.libertybasic.com)