I have the following code:
Code:
char* pch = strtok(line, " ");
int h;
for (h = 0; pch != NULL; h++){
if (h == 0){
target = StringConstruct(pch);
pch = strtok(NULL, " ");
printf("Target %s\n", target);
}
else if (strlen(pch) > 1){
strcpy(dep[depIndex], pch);
printf("Dependencies %s\n", dep[depIndex] );
depIndex++;
}
pch = strtok(NULL, " ");
}
if I use this string:
Name : John
the strlen of John will be 5 instead of 4
If I use this
Name: John Legend
the strlen of John will be 4 but Legend will be 7, how do I fix this?