Extracting fields from text file containing raw data..

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Feb 2008
Posts: 2
Reputation: sachinvador is an unknown quantity at this point 
Solved Threads: 0
sachinvador sachinvador is offline Offline
Newbie Poster

Extracting fields from text file containing raw data..

 
0
  #1
Feb 16th, 2008
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.......
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 2,048
Reputation: Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of 
Solved Threads: 179
Aia's Avatar
Aia Aia is offline Offline
Postaholic

Re: Extracting fields from text file containing raw data..

 
1
  #2
Feb 16th, 2008
You can parse the string looking for spaces using the function strtok.
Or you can do it in this way
"If it moves, tax it. If it keeps moving, regulate it, and if it stops moving, subsidize it" - Ronald Reagan
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C Forum


Views: 526 | Replies: 1
Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC