From the course: Exploring C Libraries

Unlock the full course today

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

Sending data

Sending data - C Tutorial

From the course: Exploring C Libraries

Start my 1-month free trial

Sending data

- [Instructor] This exercise file uses the FTP protocol in the libcurl library to upload an image file to a website. A website placeholder is specified at line 19. To make this code run legitimately, this string must be replaced with a valid FTP site address, including directories and a file name. Line 20 sets the username and password for the FTP site. Again, these values are placeholders. The file is specified at line 21 and it is available with the exercise files. The first step in the process is to open the file and store it in memory. Line 31 opens the file, then storage is allocated for a buffer. The data chunk structure is used, which is declared back at line 12, and it's required for the callback function which puts the information to the FTP site. A while loop starting at line 48 reads the file. It also reallocates storage as required. And the file is closed at line 70 with its data now stored in memory.…

Contents