前提:VS2010 ,MFC ,文本文件为ANSI格式。 读文件: CString str,fileContent; CStdioFile myFile, File; if(myFile.Open(GeneralUtils::GetModuleDir()+_T(\\mx.txt), CFile::modeRead)) { //读取 while(myFile.ReadString(str)) { str = str + _T("\n"); ReadStringCharToUnicode(str); fileContent = fileContent + str; } myFile.Close(); } 写文件: *.h #include <locale.h> *.cpp setlocale(LC_CTYPE,"chs"); myFile.Open(GeneralUtils::GetModuleDir()+_T(\\mx2.txt), CFile::modeWrite | CFile::modeCreate); myFile.WriteString(fileContent);...
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Get in touch with CString
Contact CString, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack