int - > char *....

song의 이미지

구현한 string token함수는 구분자(char *) 를 받습니다.

ascii 4번을 구분자로 해줘야 합니다.

itoa 가 없어서 간단히
sprintf(get_int,"%d",toascii(4)); 이런식으로 버퍼에 담았습니다.

하지만 캐스팅이 되질 않는군요.

참고 함수 입니다.

char ** tokenize(const char *string, const char *delim, int *n)
{
char **res = NULL;
const char *nxt, *prev;
char *tmp;
int step = strlen(delim);
int i;

/* Check is there is something to tokenize */
tmp = str_clean(string);
if(!strcmp(tmp, ""))
{
*n = 0;
efree(tmp);
return NULL;
}
efree(tmp);

/* Ok, go on */
nxt = string - step;
for(i = 0; strstr(nxt + step, delim) != NULL; i++)
{
char *tmpstr;

res = erealloc(res, (i + 1) * sizeof(char *));
prev = nxt + step;
nxt = strstr(prev, delim);
tmpstr = emalloc((nxt - prev + 1) * sizeof(char));
memcpy(tmpstr, prev, nxt - prev);
tmpstr[nxt - prev] = 0;
res[i] = str_clean(tmpstr);
efree(tmpstr);
}

res = erealloc(res, (i + 1) * sizeof(char *));
res[i] = str_clean(nxt + step);

*n = i + 1;

return res;
}

cdpark의 이미지

char my_delim[2];

my_delim[0] = 4;
my_delim[1] = 0;

:)