I have a cstring object str = “5043”, now i want to convert to Hex and put it in UCHAR array like
UCHAR sample[2];
Sample[0] = 0X50
Sample[1] = 0X43
How can i do this? please advice me
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can scan the hex values directly from the string using
sscanf(), something like below:his for short andxis for hexadecimal obviously.Also, this assumes that the
UCHARarray is declared to be half as large as thestringsize.