Advertisement

根据Windows API下载HTTP文件

阅读量:

通过访问http链接,即可启动文档的下载流程。

复制代码
 #define _CRT_SECURE_NO_WARNINGS

    
 #include <stdio.h>
    
 #include <tchar.h>
    
 #include <windows.h>
    
 #include <wininet.h>
    
 #include <string>
    
  
    
 //加入连接库
    
 #pragma comment(lib, "wininet.lib")
    
  
    
  
    
 char * UnicodeToANSI(const wchar_t* str)
    
 {
    
 	char* result;
    
 	int textlen;
    
 	textlen = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
    
 	result = (char *)malloc((textlen + 1)*sizeof(char));
    
 	memset(result, 0, sizeof(char) * (textlen + 1));
    
 	WideCharToMultiByte(CP_ACP, 0, 

全部评论 (0)

还没有任何评论哟~