C Http下载文件//HTTP DownloadToFile//特别注意:虽然引用头文件和lib库会报告并编译错误,但# include windows.h # include tchar ws2_32.lib ' ) string URL=' http://a3.att.hudong.com/14/75/0130000164186121366756803686.jpg '; size_t len=url.length (; //获取字符串长度intn mlen=multibytetowidechar (CP _ ACP,0,url.c_str ),len 1,NULL,0 ); 如果//函数成功运行且cchWideChar为零,则//返回值为接收目标字符串的缓冲区所需的宽字符数。 whar _ t * buffer=new wchar _ t [ nm len ]; multibytetowidechar(CP_ACP,0,url.c_str ),len 1,buffer,nmlen ); hresult HR=urldownloadtofile (null,buffer,_t(e:(sky.jpg ),0,null ); if(HR==s_ok ) cout ' downloadfile is success ' endl; }下载结果截图