Simple deffinition of a simple problem that is bugging me and cant get the exact output I desire.
I am retrieving a long binary value from the registry which comes through like this
01 00 00 0a 00 12 00 00
2c 11 08 00 00 00 00 01
b0 04 00 00 00 01 01 00
01 01 00 12 34 00 00 02
When i get this value and hold it in an object (of base type OBJECT} it converts to a byte array with 32 elements. Each elements represents each of the 2byte Hex tickets.
I am interested in is the values of 0x[16] and 0x[17] (represented here by B0 and 04.
this is stored in my byte array as
MyByteArray[15] is held as int 176
MyByteArray[16] is held as int 4
I have an integer value somewhere else, lets say 400.
If I convert this to a string and format it as hex i get 0190
I now need to split the hex string into Hex1 (holding 01) and Hex2 (holding 90)
Convert these back into from single 16b Hex vals into ints
MyByteArray[15] = intHex1 = 1
MyByteArray[16] = intHex2 = 144
----------------------------------
Been messing with this for a while now, and the problem that I am having is that I cant get my new ints into the byte array, becasue i get the message
object cannot be accessed with []
and I can not cast it on it's inception,cause int, char and string arrays aren't valids casts for the action and obviously singles wont hold it, so it just comes in as a registrey value always held in object.
Neil J Cotton
njc Information Systems
Systems Consultant
I am retrieving a long binary value from the registry which comes through like this
01 00 00 0a 00 12 00 00
2c 11 08 00 00 00 00 01
b0 04 00 00 00 01 01 00
01 01 00 12 34 00 00 02
When i get this value and hold it in an object (of base type OBJECT} it converts to a byte array with 32 elements. Each elements represents each of the 2byte Hex tickets.
I am interested in is the values of 0x[16] and 0x[17] (represented here by B0 and 04.
this is stored in my byte array as
MyByteArray[15] is held as int 176
MyByteArray[16] is held as int 4
I have an integer value somewhere else, lets say 400.
If I convert this to a string and format it as hex i get 0190
I now need to split the hex string into Hex1 (holding 01) and Hex2 (holding 90)
Convert these back into from single 16b Hex vals into ints
MyByteArray[15] = intHex1 = 1
MyByteArray[16] = intHex2 = 144
----------------------------------
Been messing with this for a while now, and the problem that I am having is that I cant get my new ints into the byte array, becasue i get the message
object cannot be accessed with []
and I can not cast it on it's inception,cause int, char and string arrays aren't valids casts for the action and obviously singles wont hold it, so it just comes in as a registrey value always held in object.
Neil J Cotton
njc Information Systems
Systems Consultant