kodr
Programmer
- Dec 4, 2003
- 368
Can anyone point me in the right direction here?
I'm trying to parse a variable, where it contains 3 pieces of information.
A sample of the string looks like this:
"172.0.0.1 Miami 3"
The IP address, city name and last digit are all seperated by tabs (can't use spaces because of cities like "New York".)
I'm trying to use strtok to seperate out the individual pieces of data, but I'm not quite sure how.
For brevity I left of the code where I open the file, that portion is working correctly, but I think my problem is the "'t", I thought that would tell it to seperate at a tab, but appearently it doesn't.
Any thoughts?
I'm trying to parse a variable, where it contains 3 pieces of information.
A sample of the string looks like this:
"172.0.0.1 Miami 3"
The IP address, city name and last digit are all seperated by tabs (can't use spaces because of cities like "New York".)
I'm trying to use strtok to seperate out the individual pieces of data, but I'm not quite sure how.
Code:
sIP = ""
sMarket = ""
sTemp = ""
fgets 0 sTemp
strtok sIP sTemp "'t" 1
strtok sMarket sTemp "'t" 1
sPathTemp = sMarket
For brevity I left of the code where I open the file, that portion is working correctly, but I think my problem is the "'t", I thought that would tell it to seperate at a tab, but appearently it doesn't.
Any thoughts?