
Originally Posted by
zeco
Stop holding out on me. Tell me what was wrong. I'm gonna go crazy.
My hypothesis is that it has to do with the strtok function.
Yeh sorry that was wrong of me...
The p[1] was originally assigned like this
p[1] = temp
temp was assigned like this...
temp = strtok(init_str, " \"");
and init_str had str copied into it like so...
strcpy(init_str, str);
The problem came about when I tried to use the same init_str that p[1] was pointing to and copied str into it...
strcpy(init_str, str);
now p[1] points to the init_str, but there are no null pointers now seperating elements, because init_str has not been tokenized yet.
So I fixed that by creating a new string and not reusing init_str, but I think there's a better way to do it. The whole thing is poorly designed. Once I finish I will post the full source, but I want to make sure it looks good first. It's no good posting source that is so poorly designed no one can understand it. =/