Ask Experts Questions for FREE Help!
 

Free Answers in 3 Easy Steps

Register Now
3 Steps
 


Ask QuestionsprogressAnswer QuestionsprogressBuild ReputationprogressBecome an Expert
 
At Ask Me Help Desk you can ask questions in any topic and have them answered for free by our experts. To ask questions or participate in answering them you must register for a free account. By registering you will be able to:
  • Get free answers from experts in any of our 300+ topics.
  • Accept money for answers that you provide.
  • Communicate privately with other members (PM).
  • See fewer ads.
  View Answers    Answer this question    Ask a question  
 

rrr
Jan 3, 2007, 06:16 AM
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:

LTheobald
Jan 3, 2007, 09:20 AM
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 (http://www.libertybasicuniversity.com/lb3docs/index.html)

rrr
Jan 4, 2007, 12:15 AM
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:

print "Enter a valid path for a file so that this program can erase it :)"
input path$
kill$(path$)

Liberty basics helpfiles description:
KILL "filename.ext"
This command deletes the file specified by filename.ext. The filename can include a complete path specification.

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.
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 (http://www.libertybasic.com)
fun fact: i am thirteen :D

Carl Gundel
Jan 11, 2007, 01:37 PM
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)

rrr
Jan 15, 2007, 03:02 AM
Thank you very much, carl. It's a honor to have been helped by you
*bows deeply*
:D:D:D