Link to home
Start Free TrialLog in
Avatar of 03671328
03671328Flag for United States of America

asked on

vb.net hex to file

im trying to convert in vb.net

10 43 74 98 F0 9A 7D CB C1 FA 7A A1 01 FE 97 6E
40 30 0D 06 09 2A 86 48 86 F7 0D 01 01 05 05 00 ect

what do i need to do to take 10 and wite that to file ...

the code below will not work as exptected ...
if i toss in the 00 it will write 00 but if i toss in 11 it will write 0B
any ideas how to fix this problem

thanks in advance.
Dim byteData As Byte = Byte.Parse("00")
Dim oFileStream As System.IO.FileStream
oFileStream = New System.IO.FileStream("bytes.dat", System.IO.FileMode.Append)
oFileStream.WriteByte(byteData)
oFileStream.Close()

Open in new window

Avatar of Bob Learned
Bob Learned
Flag of United States of America image

You should be able to do this:

Dim byteData As Byte = 11

Avatar of 03671328

ASKER

tryed that comes back as 0B
0B (hex) is 11 (decimal), so what are you REALLY trying to do here?
i'm trying to write the hex? to the file
i'm trying to take hex and write exactly that to a file.

if i get a string of 11 20 10 18 11 22 22 34
i want it to write just that.
i can split it up just not sure how to write exactly what is there.
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial