I was tokenizing, and used strtok on a text file (which has been read into an array ‘store’) with the delimiter ‘=’
so there was a statement in the file : TCP.port = 180
And I did:
str = strtok(store, "=");
str= strtok(NULL, "=");
Now if I do *str, it gives me ’82’ (probably some junk value)
but atoi(str); gives me 180 (the correct value)
I was hoping someone could shed light onto this, shouldn’t dereferencing str give me 180 too?
Compile and run this program. It should give you a better idea of what’s going on.
Here’s the output: