NX二次开发-根据文件名删除文件

NX二次开发-根据文件名删除文件

1 void DeleteFileByFileName(const std::string& fileName)
2     {
3         if (CheckFileExist(fileName))
4         {
5             remove(fileName.c_str());
6         }
7     }
 1 bool CheckFileExist(const std::string& fileName)
 2     {
 3         if (fileName.empty())
 4         {
 5             return false;
 6         }
 7 
 8         std::ifstream ifs(fileName.c_str(), std::ios_base::in);
 9 
10         if (ifs.is_open())
11         {
12             ifs.close();
13             return true;
14         }
15         else
16         {
17             return false;
18         }
19     }
原文地址:https://www.cnblogs.com/xiang-L/p/14132753.html