CString strFolderPath="c:\\test"
// 判断路径是否存在
if (!PathIsDirectory(m_strFolderPath) )
{
CString strMsg;
strMsg.Format ("指定路径\"%s\"不存在,是否创建?", m_strFolderPath);
if (AfxMessageBox(strMsg, MB_YESNO) == IDYES)
{
if (!CreateDirectory(m_strFolderPath, NULL ) )
{
strMsg.Format ("创建路径\"%s\"失败!是否继续?", m_strFolderPath);
if (AfxMessageBox(strMsg, MB_YESNO) == IDYES)
return;
}
}
}

 

//*************************************************************

DWORD dwAttr=GetFileAttributes("d:\\YourFloder");

//若文件夹不存在,创建文件夹

if(dwAttr==0xFFFFFFFF)

CreateDirectory("d:\\YourFloder",NULL);

//文件夹存在

else if(dwAttr & FILE_ATTRIBUTE_DIRECTORY){

 //do something

}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-27
  • 2021-06-22
  • 2022-12-23
  • 2021-10-13
  • 2021-10-05
  • 2021-10-28
猜你喜欢
  • 2021-06-13
  • 2022-12-23
  • 2021-09-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案