Converting a byte array into usable data

  • Thread starter Thread starter T Gregory
  • Start date Start date
T

T Gregory

Guest
I'm taking a string that holds a byte array and converting it like this...


byte[] bytes = Encoding.ASCII.GetBytes(byteArrayString);

But I'm unsure how to best convert the various elements of this array into usable data.

The first 8 bytes should represent date/time and then every 4 bytes after that represent various floating values.

Any ideas on the best way to get this data into their proper types?

Here's an example of the byte array converted to a string if it helps:

24-01-00-00-5E-3D-00-00-4D-03-36-10-01-00-00-00-3F-14-15-42-3F-3A-02-42-3F-3A-02-42-3F-3F-10-42
21-5E-10-42-3F-3F-04-42-12-3F-08-42-00-3F-3F-41-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F
00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F
00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F
00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F
00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-00-00-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F
00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F
00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F
00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F-00-00-3F-3F
00-00-3F-3F-00-00-3F-3F-00-00-3F-3F

Thanks!

Continue reading...
 
Back
Top