I didn't want to write all the code so that's why I abbreviate it in my first post.
Code:
typedef struct include_table{
char *ctrl_id;
int *ctrl_value;
}FINCLUDE;
int fill_inc_struct(char **a_p_ibuf, FINCLUDE *f_table, int total)
{
int i=0, x=0;
for (i=0; i<total; i++)
{
if (!isdigit(*a_p_ibuf[i]))
{
f_table[x].ctrl_id = *(a_p_ibuf+i);
printf(" %s \n",(f_table[x].ctrl_id));
}
else
{
f_table[x].ctrl_value=(int*)(a_p_ibuf[i]);
printf(" %d \n",(f_table[x].ctrl_value));
x++;
}
}
return 1;
}
What I am trying to do is fill the structure with the data from my **p variable that points to the begining of each of the strings ... TITLE 101 CODE 102.... (**p point to T and 1 and C and 2....). My structure should have at the end
ctrl_id = TITTLE
ctrl_value = 101 and so on..
I have no problem with the char pointer, cause it prints what it should("TITLE, CODE), but the int pointer prints 12343039... 1243066.. ans it should print 101... 102.
Could somebody tell me what the problem is.
thanks