How would you convert a const char to a BYTE array?
How would you convert a const char to a BYTE array?
So what do you have, a single char? And you want to make it into an array of BYTE?
Shouldn't require much more than declaring an array with one element and putting the char in that - you may have to cast the char, depending on the declaration of BYTE (it may be an unsigned char).
--
Mats
example:
(something like this)
now listens
to
0x77 0x20 0x6C 0x69 0x73 0x74 0x65 0x6E 0x73
I'm not sure your new comment actually adds anything useful to your previous question.
Are you asking how to print "w listens" as "0x77 0x20 ..."?
Using printf("0x%x", some_char); will do that..
--
Mats
This seems to have done it...
Thanks.Code:BYTE *bArray; for ( int x = 0; x < iLength; x++) { bArray[x] = szBuf[x]; Log("[Packet]: 0x%X [Array]: 0x%X", szBuf[x], bArray[x]); }
I hope you are allocating some memory for bArray to point to...
--
Mats
This loop maybe better to replace with one call to memcpy wich probably will do the same work faster...Code:for ( int x = 0; x < iLength; x++) { bArray[x] = szBuf[x]; }
Logging - you'll need to do as it is
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler