64,648
社区成员
发帖
与我相关
我的任务
分享
wchar_t szFilter[] = _T("");
CFileDialog fd(TRUE, NULL, NULL, OFN_EXPLORER | OFN_NOCHANGEDIR, szFilter, NULL, 0);
DWORD MAXSIZE = 10000;
fd.m_ofn.nMaxFile = MAXSIZE;
fd.m_ofn.lpstrInitialDir = NULL;
WCHAR *strFile = new WCHAR[MAXSIZE];
fd.m_ofn.lpstrFile = strFile;
fd.m_ofn.lpstrFile[0] = NULL;
if(fd.DoModal() == IDCANCEL)
{
return 0;
}
POSITION pos = fd.GetStartPosition();
vector<CString> vtFileName;
vector<CString>::iterator iter;
while(pos != NULL)
{
vtFileName.push_back(fd.GetNextPathName(pos));
}
CString strFileName = vtFileName.at(0);
CFile cfile;
CFile cwfile;
cfile.Open(strFileName, CFile::modeRead, NULL);
int FileSize = cfile.GetLength();
BYTE *btFileMatter = new BYTE[FileSize];
cfile.Read(btFileMatter, FileSize);
BOOL isCreate = CreateDirectory(_T("D:\\aaa"), NULL);
BOOL isCreate1 = CreateDirectory(_T("D:\\aaa\\ccc\\ddd"), NULL);
cwfile.Open(_T("D:\\aaa\\ccc\\a.txt"), CFile::modeCreate | CFile::modeWrite, NULL);
cwfile.Write(btFileMatter, FileSize);