日記「芦」
If the code and the comments disagree, then both are probably wrong. - Norm Schryer WININETのHTTP通信 2011/3/02(Tue.)
#include <windows.h> /*先にこれ*/
#include <wininet.h>
#pragma once
#pragma comment(lib,"wininet.lib")
int main(){
HINTERNET hInet, hFile;
char url[]="http://www.google.com/";
char buf[128];
DWORD bufsize;
hInet=InternetOpen("Mojilla/uso",INTERNET_OPEN_TYPE_DIRECT,
NULL,NULL,0);//エージェント名、接続方法フラグ
hFile=InternetOpenUrl(hInet,url,NULL,0,
INTERNET_FLAG_RELOAD,0);
if(hFile==NULL){
fprintf(stderr,"cannot connect");
exit(-1);
}
while(InternetReadFile(hFile,buf,sizeof(buf),&buffsize){
if(buffsize==0)break;
printf("%s",buf);
}
return 0;
}
コメ(0) | トラ(0)
(c)Kero's World