ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
For my history homework, I have to lookup the distance between like 60 cities. And, me being lazy, would like to know how to do this in C/C++. I don't know much about sockets (because I used to use dev c, on windows). Is there any cgi-script that it could use and then format the data?
Dude, you're trying to kill a fly with a sledgehammer. You don't need socket programming to look up distances between cities. By the time you've entered the names of each city in a text file, you could have the information already. Just go to www.mapquest.com, choose driving directions, then enter the city/state combinations.
To get the same result with socket programming you obviously have to set up the program, then you need to figure out the protocol (sounds like HTTP) to communicate with the server, and then parse the the data when it comes back.
If you proclaim to be "lazy" then I guarantee you writing a socket program is most definitely not the path of least resistance.
this is just a rough idea and might be a load of rubbish but anyway, when you goto one of these websites and type in the place names it must go to some html page like(this is made up)
distances.com/find?start=London&end=Edinburgh
you can see where it goes by looking at the html source and see what happens to the contents of the edit boxes. using perl or awk you could then take your file of places and produce a file containing the url's, you could then run that through wget and get the html pages with all the distances on. which you could then extract with grep.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.