用时间类型的转换出错了

石灰石石英石 石灰石石英石 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
警告:warning C4996:'swprintf': swprintf has been changed to conform with the ISO C standard, adding an extra character count parameter.To use traditional Microsoft swprintf,set_CRT__NON_CONFORMING_SWPRINTFS
错误:error C2664: “void ATL::CStringT<BaseType,StringTraits>::Format(const wchar_t *,...)”: 不能将参数 1 从“const char [26]”转换为“const wchar_t *” c:\users\administrator\desktop\2-3.cpp 121 1 os_test2_2-3

头文件:

//# include <windows.h>
# include <iostream>
# include <stdio.h>
# include <afx.h>
# include <cstring>
//#include <iostream.h> // b0:
static LPCTSTR g_szMutexName =(LPCTSTR) "w2kdg.ProcTerm.mutex.Suicide" ;

using namespace std;

main函数:
int main(int argc, char* argv[] )
{
// 决定其行为是父进程还是子进程

if (argc > 1 && strcmp(argv[1] , "child" )== 0)
{
Child() ;
}
else
{
Parent() ;
}
HANDLE hProcess;
FILETIME ftCreation, ftExit, ftKernel, ftUserStart, ftUserEnd;
LPSYSTEMTIME stCreation, stExit;
hProcess = GetCurrentProcess();
GetProcessTimes(hProcess, &ftCreation, &ftExit, &ftKernel, &ftUserStart);
CTime cc(ftCreation);
CString str;
str.Format("Created at %02d:%02d:%02d", cc.GetHour(),
cc.GetMinute(), cc.GetSecond());

cout<<"调用GetProcessTimes函数: "<<str<<endl;
Sleep(5000);

return 0;
}
警告的地方: swprintf(szCmdLine, L"\"%s\" child" , szFilename) ;//命令行参数
出错的地方:str.Format("Created at %02d:%02d:%02d", cc.GetHour(), cc.GetMinute(), cc.GetSecond());
~~~~~~~~~~~~~~我是菜鸟,希望解释的清楚一点。thank you!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...全文

相关推荐

评论 4
收藏 已收藏
分享
返回顶部
石灰石石英石
C++ 语言 65,214 成员 250,514 内容