MFC工控项目实例之四在调试目录下创建指定文件夹

承接专栏《MFC工控项目实例之三theApp变量传递对话框参数》

在调试目录Debug下创建DATA、LIB、TEMP三个文件夹

1、SEAL_PRESSURE.h中添加代码

cpp 复制代码
class CSeatApp : public CWinApp
{
...
public:
	CString	m_Path;
	CString	m_DataPath,m_TempPath,m_LibPath;
...
};

2、SEAL_PRESSURE.cpp中添加代码

cpp 复制代码
CSEAL_PRESSUREApp::CSEAL_PRESSUREApp()
{
	// TODO: add construction code here,
	// Place all significant initialization in InitInstance
			TCHAR exeFullPath[MAX_PATH];
	GetModuleFileName(NULL,exeFullPath,MAX_PATH);
	m_Path = exeFullPath;
	for(int i = m_Path.GetLength() - 1; i > 0 ; i --)
	{
		if(m_Path.GetAt(i) == '\\')
			break;
	}
	SetCurrentDirectory(m_Path);
	m_Path = m_Path.Left(i);
	m_DataPath = m_Path + "\\DATA\\";
	m_TempPath = m_Path + "\\TEMP\\";
	m_LibPath = m_Path + "\\LIB\\";	
	CreateDirectory(m_LibPath,FALSE);
	CreateDirectory(m_DataPath,FALSE);
	CreateDirectory(m_TempPath,FALSE);
}

运行程序

相关推荐
clint4562 天前
C++进阶(1)——前景提要
c++
夜悊2 天前
C++代码示例:进制数简单生成工具
c++
郝学胜_神的一滴2 天前
CMake 021: IF 条件判据详诠
c++·cmake
_wyt0013 天前
洛谷 B3930 [GESP202312 五级] 烹饪问题 题解
c++·gesp
玖玥拾3 天前
C/C++ 数据结构(七)栈、容器适配器
c语言·数据结构·c++··容器适配器
один but you3 天前
constexpr函数
c++
凡人叶枫3 天前
Effective C++ 条款41:了解隐式接口和编译期多态
java·开发语言·c++·effective c++
凡人叶枫3 天前
Effective C++ 条款42:了解 typename 的双重意义
java·linux·服务器·c++
小胖xiaopangss3 天前
BRpc使用
c++·rpc
-森屿安年-3 天前
63. 不同路径 II
c++·算法·动态规划