Downloading an image

This is a discussion on Downloading an image within the C++ Programming forums, part of the General Programming Boards category; Hey guys, I am writing a program to download images.
But the catch is that i need the file name ...

Downloading an image

Hey guys, I am writing a program to download images.
But the catch is that i need the file name to be read from a .mdb file.
There are multiple filenames that I would need to pull from the database so that would need to be a variable.

So basically I am asking how you can download an image from the web with the filename being a variable.

I wrote some code to download images for a test application before, so I can post the main function here which does most of the work. Keep in mind this code is Windows specific, so it won't do you much good if you are using other platforms.

Note that this sample uses malloc/free, which is not recommended for C++. Instead use new/delete.

It is fine to use malloc/free in C-code that is included inside C++ code - there's as far as I know, nothing to suggest that new/delete does anything significantly different from malloc/free, and malloc/free is certainly not "bad" in any way - they are of course not recommended for NEW C++ code. But if you are using existing C-code in a C++ project [like the above code], then that's a valid use.