char filePath[] = "C:/test"; // At frist, check path exists or not if( !PathFileExists(filePath) ) { BOOL isDirSuccessFlg = FALSE; // Define create directory flag SECURITY_ATTRIBUTES attrib; // Define security attributes variable attrib.nLength =sizeof(SECURITY_ATTRIBUTES); attrib.bInheritHandle = FALSE; attrib.lpSecurityDescriptor = NULL; // Create directory isDirSuccessFlg = CreateDirectory( filePath, &attrib); if( !isDirSuccessFlg ) { // Create directory failed AfxMessageBox("Create directory failed!"); } } // Get time SYSTEMTIME st; ::GetLocalTime(&st); char sDate[15] = ""; wsprintf(sDate, "%04d%02d%02d%02d%02d%02d", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
VC创建目录及取得系统时间的方法
最新推荐文章于 2021-05-21 10:08:53 发布
本文介绍如何检查并创建指定的文件夹路径(如C盘),同时演示了如何利用Windows API函数来创建目录,并获取当前系统时间,将其格式化为特定字符串。
1083

被折叠的 条评论
为什么被折叠?



