I would like to download an html file using c++. I have some code that works with Visual Studio but I need it to run in unix and be able to be compiled with gcc. I found a lot of questions similar to this with good answers but nothing that works in unix. Here is my code that works perfectly in visual studio...
#include <urlmon.h>
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
char webAddress[256] = "https://www.ibm.com/us-en/?ar=1";
char szFileName[80] = "ibm.html";
HRESULT hr = URLDownloadToFile(NULL, webAddress, szFileName,0, NULL);
if (hr == S_OK)
{
ifstream fin(szFileName);
char szBuff[2048];
}
else
{
cout << "Operation failed with error code: " << hr << "\n";
}
return 0;
}