How to do hex8 encoding in c?
- by Tech163
I am trying to encode a string in hex8 using c. The script I have right now is:
int hex8 (char str) {
str = printf("%x", str);
if(strlen(str) == 1) {
return printf("%s", "0", str);
} else {
return str;
}
}
In this function, I will need to add a 0 ahead of the string if the length is less than 1. I don't know why I'm getting:
passing argument 1 of 'strlen' makes pointer from integer without a cast
Does anyone know why?