CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2004
    Posts
    12

    Reading hexadecimal values from a file.

    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

  2. #2
    Join Date
    Nov 2002
    Location
    Columbus, Ohio
    Posts
    117
    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.
    Its better to have people think you're a fool than to open your mouth and remove all doubt.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured