[C++] 纯文本查看 复制代码 TCHAR szPath[] = _T("某某某~");
TCHAR szTemp[MAX_PATH] = { 0 };
GetTempPath(MAX_PATH, szTemp);
wstring wstr(szTemp);
wstr += to_wstring(GetTickCount());
SECURITY_ATTRIBUTES SecurityAttributes;
memset(&SecurityAttributes, 0, sizeof(SECURITY_ATTRIBUTES));
CreateDirectory(wstr.c_str(), &SecurityAttributes);
CreateDirectory((wstr + _T("\\....\\")).c_str(), &SecurityAttributes);
MoveFile(szPath, (wstr + _T("\\....\\TemporaryFile")).c_str());
MoveFile((wstr + _T("\\....\\")).c_str(), (wstr + _T("\\TemporaryFile")).c_str());
DeleteFile((wstr + _T("\\TemporaryFile\\TemporaryFile")).c_str());
RemoveDirectory((wstr + _T("\\TemporaryFile")).c_str());
RemoveDirectory(wstr.c_str());
|