Data read by libcurl functions can be saved to an open file or stored in memory, depending on how various options are set. When configured to save information to a file, the file is written using whatever data is read from the web. When configured to save information to memory, a special function is used to monitor the bytes read and increase the buffer size as new data arrives.
- Unless you direct it to do otherwise, … text generated by the libcurl function … curl_easy_perform is sent to standard output. … You can, however, save the text to a file … or redirect it to a buffer … providing you set the proper libcurl options. … So this code fetches information from a webpage … and saves it to a file. … The file is opened at line 14 … by using standard C library functions. … The libcurl easy interface is initialized … at line 22, … followed by various options. … At line 26, … the URL is specified. … At line 32, … the WRITEFUNCTION is set to the NULL pointer, … which directs libcurl to look for a file handle, … which is set at line 35. … So the output it sent to the open file … and not to standard output. … The file opened is closed at line 48. … And line 50 outputs a message to the user, … otherwise the program runs successfully … and would generate no output. … Now, I've already compiled the program. … So, we'll run it to see what it does. … It fetches the data, …
- Finding, installing, and linking libraries
- Accessing and generating XML data
- Working with JSON
- Working with the libcurl library
- Text programming
- Reading, writing, and manipulating JPEG images
- Working with PNG images
Skill Level Advanced
1. Setup and Configuration
2. Data Structures
3. Web Access
4. Text Programming
5. Computer Graphics
- 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.