How to do hex8 encoding in c?
Posted
by Tech163
on Stack Overflow
See other posts from Stack Overflow
or by Tech163
Published on 2010-05-28T21:21:08Z
Indexed on
2010/05/28
21:32 UTC
Read the original article
Hit count: 178
Filed under:
c
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?
© Stack Overflow or respective owner