Ask Experts Questions for FREE Help !
Ask
    rrr's Avatar
    rrr Posts: 91, Reputation: 1
    Junior Member
     
    #1

    Jan 3, 2007, 07:16 AM
    "kill" command in liberty basic
    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's Avatar
    LTheobald Posts: 1,051, Reputation: 127
    Ultra Member
     
    #2

    Jan 3, 2007, 10: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
    rrr's Avatar
    rrr Posts: 91, Reputation: 1
    Junior Member
     
    #3

    Jan 4, 2007, 01: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:

    Code:
    print "Enter a valid path for a file so that this program can erase it :)"
    input path$
    kill$(path$)
    Liberty basics helpfiles description:
    Code:
    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
    Fun fact: I am thirteen :D
    Carl Gundel's Avatar
    Carl Gundel Posts: 2, Reputation: 2
    New Member
     
    #4

    Jan 11, 2007, 02:37 PM
    Quote Originally Posted by rrr
    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
    rrr's Avatar
    rrr Posts: 91, Reputation: 1
    Junior Member
     
    #5

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

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Fan Blower not working in "ON" or "AUTO" in heat or AC [ 13 Answers ]

Got home from the Brewer game this afternoon and noticed the house was warm(78). Outside was 91. I checked the T-stat and it was set correct. Noticed the air vents weren't blowing anything. Went outside and the condenser and fan was running fine. Then I went downstairs to the furnace unit to see...

Pink pill with "watson" and "502" on it [ 2 Answers ]

What kind of pill is pink and has watson 502 on it?

Liberty basic "drawbmp" command is acting up [ 5 Answers ]

I use xp home edition and have liberty basic v.4.03 The code goes like folowing: Loadbmp "bmpname", "bmppath" Graphicbox #window.graphicbox, 5, 5, 447, 511 Open "window" for dialog_popup as #window Print #window.graphicbox "drawbmp bmpname 0 0" <-- error in this line Wait I have...

Heater blows cold when "On", not at all on "Auto" [ 1 Answers ]

Our gas heater is 7 years old, and has worked fine in the two years we've rented here. This winter though, we can't get it to work consistently. When on "Auto", it doesn't turn on at all, no matter what temperature we select, and when we turn the fan to "On", it simply blows cold air. It...


View more questions Search