954,499 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Extracting fields from text file containing raw data..

I have a text file which has the following format.....

129.2.3.87 18.3.6.77 5655 2333


here the first field is source ip address then destination ip address then source port and destination port


there are many such entries..... i want to know how do i extract these fields using c program code....

it would be a great help... thanks in advance.......

sachinvador
Newbie Poster
2 posts since Feb 2008
Reputation Points: 10
Solved Threads: 0
 

You can parse the string looking for spaces using the function strtok .
Or you can do it in this way

Aia
Nearly a Posting Maven
2,392 posts since Dec 2006
Reputation Points: 2,224
Solved Threads: 218
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You