Discover the code includes quite a long main() function, required because each site is different to read and generates different data. Helper functions pull out the CSV and JSON data. The latitude and longitude values are averaged and the farthest distance obtained. The distance between the average and farthest point calculates the radius in kilometers.
- [Instructor] I'm pretty adept at using the Libcurl library…to read from website, upload files and perform FTP.…As a C language programmer, this puzzle was more about…translating curl commands in the C code.…And I'd love to separate each curl call to the various URLs…into their own functions.…But because each site returns different types of data,…this process wasn't possible.…The result is a honking huge main function in this code.…211 lines of code,…most of that is comments but still.…
Curl is initialized and first site is processed at line 68.…The second site is processed at line 112.…And you can reuse the same curl handle which you pass…to the curl_easy_reset function, then reprogram…the various perimeters.…It all works whether smoothly and I'm appreciative…of the good documentation and examples provided on…the Libcurl website.…That's curl.haxx.se/libcurl/c.…
The third site is processed at line 149.…For each site, data is read into a structure variable URL.…It stores the address, latitude and longitude values.…
Skill Level Intermediate
1. Summarize the Weather
2. Geolocation with C
3. Eight Queens with C
4. Build a Musical Instrument with C
5. Face Recognition with C
6. Web Dashboards with C
Next steps1m 2s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.