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:
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:
There might be an unload command for the file you are opening. E.g. loadbmp has a unloadbmp command to unload the file. What command are you using to load the file?
I got that from searching on the help a bit:
Liberty BASIC Online Help
I guess you misinterpreted the command, you do not use the "kill" command when handling a file, then you use the close *filehandler*
Kill is used in this way:
Liberty basics helpfiles description:Code:print "Enter a valid path for a file so that this program can erase it :)"
input path$
kill$(path$)
Even if path$ leads to a valid file, the file somehow turn into a read-only file. I tried to remove the read-only option, but it still didn't work. It turns out that it had gone back to being a read-only file.Code:KILL "filename.ext"
This command deletes the file specified by filename.ext. The filename can include a complete path specification.
And thanks for helping me!:D :D :D
If you are looking for a place to download liberty basic go here:
Liberty BASIC - Easy Programming for Windows
Fun fact: I am thirteen :D
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.Quote:
Originally Posted by rrr
SetFileAttributesA looks like the right one.
Here's a short example:
Quote:
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
Thank you very much, carl. It's a honor to have been helped by you
*bows deeply*
:D:D:D
All times are GMT -7. The time now is 01:40 PM. |