懒码农。。。。。。

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  if( !this->FolderExist(tmpUDataPath) )
{
this->CreateFolder(tmpUDataPath);
}

 

//建立目录

BOOL CreateFolder(CString strPath)
{
SECURITY_ATTRIBUTES attrib;
attrib.bInheritHandle = FALSE;
attrib.lpSecurityDescriptor = NULL;
attrib.nLength =sizeof(SECURITY_ATTRIBUTES);
//上面定义的属性可以省略。 直接return ::CreateDirectory( path, NULL); 即可
return ::CreateDirectory( strPath, &attrib);
//目录是否存在
BOOL FolderExist(CString strPath)
{
WIN32_FIND_DATA   wfd;
BOOL rValue = FALSE;
HANDLE hFind = FindFirstFile(strPath, &wfd);
if ((hFind != INVALID_HANDLE_VALUE) && (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
rValue = TRUE;   
}
FindClose(hFind);
return rValue;
}
posted on 2010-11-25 10:30  阿彬  阅读(267)  评论(0编辑  收藏  举报