#include <locale.h>                    추가
setlocale(LC_ALL, "korean");

 

 쓰기


setlocale(LC_ALL, "korean");
CString strPath = strExePath + _T("\\ClickLog.txt");   //파일저장 경로

CStdioFile file;
if (file.Open(strPath, CFile::modeCreate | CFile::modeWrite))
{
   file.SeekToEnd();                       
   file.WriteString(strText);     
   file.Close();                           
}

읽기

CStdioFile file;
CString strPath = strExePath + _T("\\ClickLog.txt");

if(!file.Open(strPath,CFile::modeRead,NULL))
   return; 

CString strText; 
while(file.ReadString(strText))
{
   TRACE(strText);
}
file.Close();

 

 

 

//출처 : https://blog.naver.com/mu_kk/130165080003

'공부 > MFC_자주쓸거' 카테고리의 다른 글

[MFC] 파일열기 대화상자 CFileDialog  (0) 2023.03.30
[MFC] Queue 초기화  (0) 2023.03.22
[MFC] 리스트 박스 값 가져오기 ListBox  (0) 2022.12.07
[MFC] 실행파일 경로  (0) 2022.12.07
[MFC] 파일 존재 여부 체크  (0) 2022.12.06

+ Recent posts