I am new to c++ and still trying to feel my way in. I have attempted to adapt a function I have found on SO to convert my string into bytes as I need:
void hexconvert(const char *text, unsigned char bytes[])
{
int i;
int temp;
for (i = 0; i < 4; ++i) {
sscanf(text + 2 * i, "%2x", &temp);
bytes[i] = temp;
}
cout << bytes;
}
hexconvert("SKY 000.001\n", );
Issues I have are:
1) I am not sure how to amend the for loop to handle my string. 2) I am not sure what I should use as the input for the second parameter in the function.
Can anyone assist?
Thanks
std::cout << std::hex << whatever << std::endl;?