How can i open a file ascii???
Printable View
How can i open a file ascii???
Huh??
Open "C:\file.txt" for input as #1
?????
NEVER use #1...
note: do not declare "Freefile"Code:dim MyFile as byte
Myfile = freefile
open "whatever" for append as #myfile
'add stuff to file
close #myfile
how can i open it in binary adn show the binary in a textbox with out it getting a error like it does to me and 2 how can i opened a file in hex and dec
You'll have to open it in binary, and then convert it to Hex
What would be the code to do this?
Prolly sumptin like:
I dunno :(Code:Dim MyFile as byte
Dim i as integer
Dim strBin as string
Open "whatever" for binary as MyFile
For i = 1 to LOF(MyFile)
Get MyFile, i, strBin
Text1 = Text1 & strBin
strBin = Hex(Asc(strBin))
Text2 = Text2 & " " & strBin
Next
Close MyFile
------------------
r0ach(tm)
here what i did and it not working look
Code:Private Sub Form_Load()
Dim MyFile As Byte
Dim i As Integer
Dim strBin As String
Dim B
CommonDialog1.ShowOpen
Open CommonDialog1.filename For Binary As MyFile
For i = 1 To LOF(MyFile)
Get MyFile, i, strBin
Text1 = Text1 & strBin
strBin = Hex(Asc(strBin))
Text2 = Text2 & " " & strBin
Next
Close MyFile
End Sub
Oops, my mistake.
You should put
MyFile = freefile
before opening the file. sorry
------------------
r0ach(tm)
i just got a voer flow on
For i = 1 To LOF(MyFile)
change
Dim i as integer
to
Dim i as long.
I just quickly threw that together. Don't trust it. ;)
------------------
r0ach(tm)
now im getting a invaild call or arugment on
strBin = Hex(Asc(strBin))
Works for me!
What's the value of strBin, when you get the error??
nothing
change
Dim strBin As String
to
Dim strBin As String * 1
be prepared to wait a while though
------------------
r0ach(tm)