使用CreateRectory()捕获error_already_exists和类似的错误
Catching ERROR_ALREADY_EXISTS and similar errors with CreateDirectory()
我希望使用CreateRectory(),RemoveRectory()和类似功能制作程序。这些命令中可能的返回错误之一error_already_exists。我想要一个IF语句来捕获此错误并在屏幕上发布消息并继续。
您需要调用GetLastError ()
并检查错误条件是否符合ERROR_ALREADY_EXISTS
;调用CreateDirectory()
并返回0。
相关文章:
- 警告处理为错误这里有什么问题
- "error: no matching function for call to"构造函数错误
- boost::进程间消息队列引发错误
- C++,OpenCV,尝试显示图像时"OpenCV(4.3.0) Error: Assertion failed (size.width>0 && size.height>0)"此错误
- 有关插入适配器的错误。[错误]请求从 'back_insert_iterator<vector<>>' 类型转换为非标量类型
- QT在错误的班级中寻找空位
- vector.resize()中的分配错误
- 代码在main()中运行,但在函数中出现错误
- 释放错误后堆使用
- (C++)分析树以计算返回错误值的简单算术表达式
- Project Euler问题4的错误解决方案
- 我的字符计数代码计算错误.为什么
- 从"int*"强制转换为"unsigned int"会丢失精度错误
- 尝试导入pybind-opencv模块时出现libgtk错误
- CMake项目Boost库错误:Boost/config/compiler/gcc.hpp:165:10:致命错误:cs
- 在某些循环内使用vector.push_back时出现分段错误
- MSVC多行宏编译器错误
- VS 链接器失败,标准::字符串方法出现"object already exists"错误
- 返回"file already exists"错误的窗口类的注册类
- 致命错误:SFML/Graphics.hpp: no such file or directory exists