프로그래밍/VC++

인터넷의 파일 하나를 열고 한줄씩 읽어오기.

panpro 2007. 3. 25. 23:02

#include "afxinet.h"

CInternetSession session;
CInternetFile * pFile = NULL;

// 파일을 연다.
pFile = (CInternetFile *)session.OpenURL("http://www.janchiall.com/selfdesign/admin/product/template/yakdo/yakdotest.asp");

// 읽어들일 버퍼사이즈를 설정한다.
pFile->SetReadBufferSize(4096);

// 데이터를 한줄씩 읽어온다.
CString strData;
for (;;)
{
if (!pFile->ReadString(strData))
  break;

MessageBox(strData);
}

delete pFile;