作业帮 > 综合 > 作业

请问下面一段代码是啥意思?

来源:学生作业帮 编辑:拍题作业网作业帮 分类:综合作业 时间:2024/04/20 03:55:50
请问下面一段代码是啥意思?
CString strImg;
CString strDire;
strImg.Empty();
strDire.Empty();
strImg = m_TempPath;
int nPos = strImg.ReverseFind('\\');
strDire = strImg.Left(nPos);
nPos = strDire.ReverseFind('\\');
 strDire = strDire.Left(nPos);
CTime timer;
timer = CTime::GetCurrentTime();
CString strTime;
strTime.Empty();
strTime.Format("\\CPK DAT\\%d%d%d%d%d%d.txt",timer.GetYear(),timer.GetMonth(),timer.GetDay(),timer.GetHour(),timer.GetMinute(),timer.GetSecond());
strDire +=strTime;
CString strImg;
\x05\x05CString strDire;
\x05\x05strImg.Empty();//字符串值空
\x05\x05strDire.Empty();
\x05\x05strImg = m_TempPath;//将这个路径字符串赋值给strlmg
\x05\x05int nPos = strImg.ReverseFind('\\');//在一个较大的字符串中从末端开始查找某个字符,返回位置
strDire = strImg.Left(nPos);//将该位置左侧的字符串赋值给strDire
nPos = strDire.ReverseFind('\\');//以下两行代码同样
\x05 strDire = strDire.Left(nPos);
CTime timer;
\x05\x05timer = CTime::GetCurrentTime();//获取当前时间
\x05\x05CString strTime;
\x05\x05strTime.Empty();//声明的字符串制空,初始化
\x05\x05strTime.Format("\\CPK DAT\\%d%d%d%d%d%d.txt",timer.GetYear(),timer.GetMonth(),timer.GetDay(),timer.GetHour(),timer.GetMinute(),timer.GetSecond());//strTime 赋值为 当前时间.txt
\x05\x05strDire +=strTime;路径strDire赋值为 之前+当前时间.txt
这段代码意思应该是生成一个txt文件的路径
例如 c://windows//system 为 m_TempPath
结果就是 c://当前时间.txt