Dec 7, 2006 #1 vbakan MIS Joined Dec 6, 2006 Messages 24 Location GB I want to read a binary file in VB and out put as text. COuld any one tell me hoe to do that please
Dec 7, 2006 #2 Bong Programmer Joined Dec 22, 1999 Messages 2,063 Location US I did put up a FAQ on the topic but here are some of the basics: Code: fname = Application.GetOpenFilename() Open fname For Binary As #1 say, to get the ball rolling. Now I have certain record length issues; perhaps you do to: Code: For j = 1 To reclen a1 = AscB(Input(1, #1)) h1 = Hex(a1) If Len(h1) < 2 Then h1 = "0" & h1 End If hnum = hnum & h1 hst = hst & Chr(a1) Next Now, hst is a hex string that has twice the number of characters as bytes you read. What to do next depends on what you mean by out put as text Click to expand... _________________ Bob Rashkin Upvote 0 Downvote
I did put up a FAQ on the topic but here are some of the basics: Code: fname = Application.GetOpenFilename() Open fname For Binary As #1 say, to get the ball rolling. Now I have certain record length issues; perhaps you do to: Code: For j = 1 To reclen a1 = AscB(Input(1, #1)) h1 = Hex(a1) If Len(h1) < 2 Then h1 = "0" & h1 End If hnum = hnum & h1 hst = hst & Chr(a1) Next Now, hst is a hex string that has twice the number of characters as bytes you read. What to do next depends on what you mean by out put as text Click to expand... _________________ Bob Rashkin