Hello people,
I have a big problem,
In my program, I recieve an variable with a value from somewere between 10 and 9999.
The problem is that this unsigned short variable has to be depicted as 4 characters, like 0031 or 0372.
And that's not all.
The big problem is the following.
The first two (HEX) numbers have to go to one unsigned char, and the last two (HEX) numbers have to go to another unsigned char.
for example:
Unsigned short ETU = 0x174;
// the unsigned chars now have to get the following value;
Unsigned char = 0x01;
Unsigned char2 = 0x74;
I tried to solve this by putting the value into a string with string.Format;
But how do i get the number 0x74 into the uchar?
I can get 7 or 4 in by using char = string[3] or string[4]
Then I can get any number between 0 and F into the char, but anything higher then that turns into a character.
Does anybody have an idee how to solve this problem?
Thanks A lot,
Martini.
I have a big problem,
In my program, I recieve an variable with a value from somewere between 10 and 9999.
The problem is that this unsigned short variable has to be depicted as 4 characters, like 0031 or 0372.
And that's not all.
The big problem is the following.
The first two (HEX) numbers have to go to one unsigned char, and the last two (HEX) numbers have to go to another unsigned char.
for example:
Unsigned short ETU = 0x174;
// the unsigned chars now have to get the following value;
Unsigned char = 0x01;
Unsigned char2 = 0x74;
I tried to solve this by putting the value into a string with string.Format;
But how do i get the number 0x74 into the uchar?
I can get 7 or 4 in by using char = string[3] or string[4]
Then I can get any number between 0 and F into the char, but anything higher then that turns into a character.
Does anybody have an idee how to solve this problem?
Thanks A lot,
Martini.