The libcurl library allows your C programs to perform the same functions as the popular curl utility, specifically sending and receiving information from the web. This video shows how to install the libcurl library and test installation.
- [Instructor] Curl is a command line utility that helps fetch and put information to the internet. Here is its homepage on the web. Https Curl.haxx.se which is Sweden. The same people who developed Curl have provided the Libcurl library for the C language. It's homepage contains a link to download, as well as links to the API documentation. Here you'll search for a package relative to your computer's operating system. For example, here's the version you could download for Windows. Which does work in code blocks. You can also obtain the library from a package manager. Here is the Windows 10 Ubuntu Bash Shell, the command is sudo apt-get install libcurl4-gnutls-dev Type the super user password, and proceed with the installation. As always, I recommend that you test the installation. Here is sample code that outputs the Libcurl version. The curl header is included at line two. The Libcurl version constant is output at line six. Let's go ahead and test this code. So you type clang and the name of the compiler. And I'll use the all warning switch. And then link in the curl library. Now the code doesn't use any library functions, so this inclusion is just to ensure that the library is properly installed, and links with no issues. And then type the source code file name. See how that works? No errors, no warnings. So run the test program, and the version is 7.47.0. Now the version you see maybe different, that's fine. After testing the installation, you're ready to start writing C code, that uses the Libcurl librarby, to access information stored on the internet. The API documentation and sample programs are found on the website. In fact, of all of the C librarie I've used, this sight has perhaps the best documentation and sample code. I hope you agree as well.
- 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