본문 바로가기
C++

CInternetFile ReadString -- File Download

by 사무실 꿀벌 2020. 5. 19.
반응형

 

CString strFullText = _T("");

CString strTemp = _T("");

while (pcInternetFile->ReadString(strTemp))
{
strFullText += CA2W((LPCSTR)strTemp.GetBuffer(), CP_UTF8);   // When reading files from CInternetFile .. Important
strTemp.ReleaseBuffer();
}

 

strFullText.Remove(_T('\t'));  // tab del

strFullText.Remove(_T('\n'));  //  del

strFullText.Remove(_T('\r'));  //  del

 

file.Open(file name, CFile::modeCreate | CFile::modeWrite);

CT2CA OutputString(strFullText, CP_UTF8);   //  When writing in encoding CFile UTF 8 ... important

file.Write(OutputString, ::strlen(OutputString));

file.Close();

반응형