C/C++の宿題やらせてください。おながいします
■ このスレッドは過去ログ倉庫に格納されています
0464デフォルトの名無しさん
NGNG#include <wininet.h>
#include <string>
#include <iostream>
#pragma comment(lib, "wininet.lib")
int main()
{
std::string url;
std::cout << "『えっとね、URLを入力してほしいの』" << std::endl;
std::cin >> url;
HINTERNET hSession = InternetOpen( "Mio", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0 );
if(hSession){
HINTERNET hService = InternetOpenUrl( hSession, url.c_str(), NULL, 0, 0, 0 );
if(hService)
{
for(;;)
{
char buf[1025];
DWORD readbyte = 1024;
InternetReadFile( hService, buf, 1024, &readbyte );
if( readbyte == 0 ) break;
buf[readbyte] = 0;
std::cout << buf << std::endl;
}
}
InternetCloseHandle(hService);
}
InternetCloseHandle(hSession);
return 0;
}
■ このスレッドは過去ログ倉庫に格納されています