Click to See Complete Forum and Search --> : Reading hexadecimal values from a file.


AnotherBuddy
July 26th, 2004, 04:55 AM
Hi,

Say, I have a text file containing hexadecimal values like this 55 4E 54 13 00 (with space in between).
Now I want to read these values from a file and store these values into a byte array as follows:

byte[] temp;
temp[0] = 55
temp[1] = 4E
temp[2] = 54
temp[3] = 13
temp[4] = 00

How can this be done?

regards,
buddy

BinaryAnge
July 26th, 2004, 07:21 AM
read in the line from the file, parse the string at every 2 digits and use Convert.ToInt32(val); Then if needed you can get its ascii value.