|
这是不是一个错误
BOOL CreateDeepDirectory(LPCTSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes)
{
if (PathFileExists(lpPathName)) return TRUE;
TCHAR szPath[MAX_PATH] = { 0 };
TCHAR pszSrc[MAX_PATH] = { 0 };
_tcscpy(pszSrc, lpPathName);
TCHAR* pToken = _tcstok(pszSrc, _T("\"));
while (pToken)
{
_tcscat(szPath, pToken);
_tcscat(szPath, _T("\"));
if (!PathFileExists(szPath))
{
if (!CreateDirectory(szPath, lpSecurityAttributes)) return FALSE;
}
pToken = _tcstok(NULL, _T("\"));
}
return TRUE;
}
_T("\"),不是会转义吗,那应该是“\\”呐,
其次,代码逻辑也应该是
_tcscat(szPath, pToken);
if (!PathFileExists(szPath))
{
if (!CreateDirectory(szPath, lpSecurityAttributes)) return FALSE;
}
_tcscat(szPath, _T("\\"));
pToken = _tcstok(NULL, _T("\"));
I'm not sure whether it's true. |
上一篇: 《C/C++ Windows 程序设计》下一篇: VC驿站《C/C++ Windows 程序设计》
|