The string input would be
> bc <address1> <address2> length
I can break the string into tokens using strtok
but not sure how to take each separate token and for example convert address1 and address 2 to hex.
void tokenize()
{
char str[] ="bc 0xFFFF0 0xFFFFF 30";
char *tkn;
char *tkn2;
tkn = strtok (str," ");
while (tkn != NULL) {
while (*tkn != 0)
{
putchar(*tkn);
*tkn++;
}
tkn = strtok (NULL, " ");
printf("\n");
}
}
So far it prints the tokens but I am not sure how to use each separately.
bc
0x000FF
0x0FFF
30