level 1
超速行驶2003
楼主
我想做个下载用的程序,但是编译时出了问题,求帮助
源代码:
#include <iostream>
#include <UrlMon.h>
#pragma comment(lib, "urlmon.lib")
using namespace std;
int main()
{
HRESULT hr = URLDownloadToFile(0, L"http//http://www.baidu.com/", L"D:\\baidu.html", 0, NULL);
if (hr== S_OK)
{
cout<< "ok"<< endl;
}
system("pause");
return 0;
}
问题:
C:\Users\Administrator\Desktop\Dev-cpp project\download\download.cppIn function 'int main()':
890C:\Users\Administrator\Desktop\Dev-cpp project\download\download.cpp[Error] cannot convert 'const wchar_t*' to 'LPCSTR {aka const char*}' for argument '2' to 'HRESULT URLDownloadToFileA(LPUNKNOWN, LPCSTR, LPCSTR, DWORD, LPBINDSTATUSCALLBACK)'
图片:

求c++大神帮助啊~
2016年12月23日 12点12分
1
源代码:
#include <iostream>
#include <UrlMon.h>
#pragma comment(lib, "urlmon.lib")
using namespace std;
int main()
{
HRESULT hr = URLDownloadToFile(0, L"http//http://www.baidu.com/", L"D:\\baidu.html", 0, NULL);
if (hr== S_OK)
{
cout<< "ok"<< endl;
}
system("pause");
return 0;
}
问题:
C:\Users\Administrator\Desktop\Dev-cpp project\download\download.cppIn function 'int main()':
890C:\Users\Administrator\Desktop\Dev-cpp project\download\download.cpp[Error] cannot convert 'const wchar_t*' to 'LPCSTR {aka const char*}' for argument '2' to 'HRESULT URLDownloadToFileA(LPUNKNOWN, LPCSTR, LPCSTR, DWORD, LPBINDSTATUSCALLBACK)'
图片:

求c++大神帮助啊~