Cstring m_content("javava");
CString fileName;
CFile file;
CFileDialog myFile(FALSE,L"*.txt",NULL,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,
L"*.txt",NULL);
if(myFile.DoModal()==IDOK){
fileName = myFile.GetPathName();
file.Open(fileName,CFile::modeCreate|CFile::modeWrite);
file.Write(m_content,m_content.GetLength()*sizeof(TCHAR));
file.Close();
}
注意要 * sizeof(TCHAR)
CString fileName;
CFile file;
CFileDialog myFile(FALSE,L"*.txt",NULL,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,
L"*.txt",NULL);
if(myFile.DoModal()==IDOK){
fileName = myFile.GetPathName();
file.Open(fileName,CFile::modeCreate|CFile::modeWrite);
file.Write(m_content,m_content.GetLength()*sizeof(TCHAR));
file.Close();
}
注意要 * sizeof(TCHAR)