标签:const att folder bool rect size director first file
1 bool CheckFolderExist(const string & strPath) 2 { 3 if (strPath.empty()) 4 { 5 return false; 6 } 7 8 WIN32_FIND_DATA wfd; 9 BOOL bValue = false; 10 HANDLE hFind = FindFirstFile(multiByteToWideChar(strPath), &wfd); 11 if ((hFind != INVALID_HANDLE_VALUE) && (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) 12 { 13 bValue = TRUE; 14 } 15 FindClose(hFind); 16 17 return bValue; 18 }
1 wchar_t * multiByteToWideChar(const string & pKey) 2 { 3 char* pCStrKey = (char*)pKey.c_str(); 4 //第一次调用返回转换后的字符串长度,用于确认为wchar_t*开辟多大的内存空间 5 int pSize = MultiByteToWideChar(CP_OEMCP, 0, pCStrKey, strlen(pCStrKey) + 1, NULL, 0); 6 wchar_t *pWCStrKey = new wchar_t[pSize]; 7 //第二次调用将单字节字符串转换成双字节字符串 8 MultiByteToWideChar(CP_OEMCP, 0, pCStrKey, strlen(pCStrKey) + 1, pWCStrKey, pSize); 9 10 return pWCStrKey; 11 }
标签:const att folder bool rect size director first file
原文地址:https://www.cnblogs.com/xiang-L/p/14373025.html