Click here to Skip to main content
15,889,874 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
guys need help... I Am Writing a web server and I receive the data from form using the get method and i receive the data
GET /?itemnumber=1&itemquan=2&firstname=Dawood&lastname=Awam&city=Atd&cardno=123

How can i Extract the Variables.. of itemnumber, itemquan,etc...
Posted

1 solution

(really old question, but there's no solution and it might be useful for other people later)

If your server is single threaded (which I doubt) then you can use strtok to slice chunks off the string using the ? and @ characters as delimeters.

If you're writing a multithreaded server then on windows, or at least later versions of VC++, you can keep using strtok as it's thread safe. If you're using a UNIXy OS then use strtok_r instead.

Cheers,

Ash
 
Share this answer
 
Comments
Nelek 15-Apr-12 6:08am    
3 Weeks old is not really old. There was a thread of 2010 that came to life in the last days. :P

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900