Converting the strtok output to integer
I'm a beginner and I'm trying to figure out how to store the result of strtok() in a Array of integers...
If I'm not mistaken, strtok brokens the string into tokens, returning a pointer to this tokens... So, if this pointer points to strings, can I use this function directly as an argument for the function atoi()?
I've tried to do this, but he results printed are zeros.
Here follows the relevant section of my code:
Thanks in advance
while(fgets(line,sizeof line,fread) != NULL)
temp = strtok(line,delims);
while (cont <= 40)
for (i=ID; i<=Pattern; i++)
Node[cont] = atoi(temp);
printf("%d \n", Node[cont]);
temp = strtok(NULL, delims);