Results 1 to 5 of 5

Thread: Doesn't someone know?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Posts
    83

    Post

    Ok i got your attention so heres a list of questions...

    1. How do you search for a binary number?
    or delete a binary number(such as one byte without replacing it)?

    2. How do you directly delete a file on the hd?

    ok one more....

    3. i have this code, yet it does not create the file im goin ???(it was before)

    Private Sub cmdcreate_Click()
    Dim x As Byte
    Dim response As Integer
    Dim Filename, typetest As String
    cdbsave.CancelError = True
    On Error GoTo saveerror
    cdbsave.Filter = _
    "Starcraft triggers (*.trg)|*.trg*"
    responseno:
    cdbsave.ShowSave
    Filename = cdbsave.Filename
    typetest = Right$(Filename, 4)
    If typetest = ".trg" Then
    Else
    Filename = Filename & ".trg"
    End If
    If Dir(Filename) = "" Then
    Else
    response = MsgBox("The file exists. Do you want to replace it?", 564, "Error: Same name")
    If response = 6 Then
    ElseIf response = 7 Then GoTo responseno
    End If
    End If
    x = 113
    Open Filename For Binary As #1
    Put #1, , x
    Close #1
    saveerror:
    End Sub

    later,
    Iceman

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    the answer to 2 is Kill()

    as for 3, I hate gotos but it seems to work though!

    ------------------
    Mark Sreeves
    Analyst Programmer

    Mark.Sreeves@Softlab.co.uk
    A BMW Group Company

  3. #3
    Lively Member Maartin's Avatar
    Join Date
    Jan 2000
    Location
    Benoni, Gauteng, South-Africa
    Posts
    99

    Post

    To delete a file from the HD use hte following Code:

    if Dir(app.path & "\test.trg") <> "" then '|Check if file does exist
    KILL (app.path & "\test.trg")
    else
    msgbox "File does not exist",vbcritical,"ERROR"
    endif

    If you use the open statment in VB and the file does not exist VB will then create the file for you.

    Check the syntax etc.

    I have never done binary searches before but I would start off by searching tru it as text.

    ------------------
    Have Fun.
    Maartin.
    dinamite@onwe.co.za
    -----------------------


    [This message has been edited by Maartin (edited 01-21-2000).]

  4. #4
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    Maartin

    binary search is not the same as searching for a binary number!

    ------------------
    Mark Sreeves
    Analyst Programmer

    Mark.Sreeves@Softlab.co.uk
    A BMW Group Company

  5. #5
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Post

    I've tried the following code and it works!

    Private Sub cmdcreate_Click()
    Dim x As Byte
    Dim response As Integer
    Dim Filename, typetest As String
    On Error Resume Next
    With cdbsave
    .CancelError = True
    .Filter = _
    "Starcraft triggers (*.trg)|*.trg*"
    .Flags = cdlOFNOverwritePrompt + cdlOFNPathMustExist
    .DefaultExt = "trg"
    .ShowSave
    If Err = cdlCancel Then
    Exit Sub
    End If
    Filename = .Filename
    End With
    On Error Goto 0
    x = 113
    Open Filename For Binary As #1
    Put #1, , x
    Close #1
    End Sub

    Good luck!

    ------------------
    Joacim Andersson
    joacim@programmer.net
    joacim@yellowblazer.com
    www.YellowBlazer.com



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width