i wanted to split this hexstring, convert em, and store em in an array. but it seems there is something off from my work, and i don't know what.
I intend to split this string
27CA6B
to
27
CA
6B
but the output is always only the first string. like
27
51819
0
please somebody help, here is my code
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
int main(void)
{
char bc[] = "27CA6B";
char *theEnd;
long result;
long resulta;
long resultb;
long resultc;
result = strtol (bc, &theEnd, 0);
resulta = strtol (theEnd, &theEnd, 16 );
resultb = strtol (theEnd, NULL, 0);
//int i = 0;
//printf("%c%c%c%c%c%c\n", bc[0], bc[1], bc[2], bc[3], bc[4], bc[5]);
printf("%ld\n", result, &bc[0]);
printf("%ld\n", resulta, &bc[1]);
printf("%ld\n", resultb, &bc[2]);
return 0;
}