Tag: wininet

WinINet无法将文件下载到客户端?

我很好奇为什么我在使用这个function时遇到了麻烦。 我正在将Web上的PNG文件下载到目标路径。 例如,将Google图像下载到C:驱动器: netDownloadData(“ http://sofzh.miximages.com/c%2B%2B/logo1w.png ”,“c:\ file.png”); 下载后文件大小正确。 什么都没有返回假。 当我尝试打开它时,它不会显示图像。 任何想法都有帮助。 谢谢! 这是代码: bool netDownloadData(const char *strSourceUrl, const char *strDestPath) { HINTERNET hINet = NULL; HINTERNET hFile = NULL; char buffer[1024]; DWORD dwRead; String sTemp; FILE *fp = NULL; DWORD size = 0; // Open a new internet session hINet = netInit(); if (hINet == […]

使用httpSendRequest c ++上传文件

我试图通过POST请求(c ++和winapi)将文件发送到HTTP服务器,步骤: // Read file into “buff” and file size into “buffSize” …. …. …. HINTERNET internetRoot; HINTERNET httpSession; HINTERNET httpRequest; internetRoot = InternetOpen(agent_info, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, NULL); //Connecting to the http server httpSession = InternetConnect(internetRoot, IP,PORT_NUMBER, NULL, NULL, INTERNET_SERVICE_HTTP, NULL, NULL); //Creating a new HTTP POST request to the default resource on the server […]