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创建目录及取得系统时间的方法
最新推荐文章于 2023-01-08 18:03:09 发布