-
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
-
the answer to 2 is Kill()
as for 3, I hate gotos but it seems to work though!
------------------
Mark Sreeves
Analyst Programmer
[email protected]
A BMW Group Company
-
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.
[email protected]
-----------------------
[This message has been edited by Maartin (edited 01-21-2000).]
-
Maartin
binary search is not the same as searching for a binary number!
------------------
Mark Sreeves
Analyst Programmer
[email protected]
A BMW Group Company
-
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
[email protected]
[email protected]
www.YellowBlazer.com