From the course: Code Clinic: C

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Building the code

Building the code - C Tutorial

From the course: Code Clinic: C

Start my 1-month free trial

Building the code

- [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…

Contents