error C2664: 'strcpy_s' : cannot convert parameter 3 from 'CString' to 'const ch

KFPA 2015-07-23 11:56:48
int _tmain(int argc, _TCHAR* argv[])
{
char n;
CString strTime; // 用于将CTime对象格式化为字符串
CTime curTime = CTime::GetCurrentTime();

cout<<GetExePath()<<endl;

/*cout<<"请输入要删除几天前的文件夹:";
cin>>n;
*/
cout<<argv[1]<<endl;

n=_ttoi(argv[1]);
// cout<<n<<endl;
CTime t=curTime-CTimeSpan(n,0,0,0);

strTime = t.Format(_T("db%Y%m%d*"));

//wcout<<(LPCTSTR)strTime<<endl;

CString m=strTime;

strcpy_s(s,256,GetExePath());
cout<<s<<endl;

strcat_s(s,256,m);
cout<<s<<endl;
transfer(s);

return 0;

1>shijianbijiao1.cpp(197): error C2664: 'strcpy_s' : cannot convert parameter 3 from 'CString' to 'const char *'
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>shijianbijiao1.cpp(200): error C2664: 'strcat_s' : cannot convert parameter 3 from 'CString' to 'const char *'
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1

怎么解决呢
...全文
103 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
QIUSQJF 2015-07-27
  • 打赏
  • 举报
回复
去看下《windows核心编程》的第二章
二班的码农 2015-07-23
  • 打赏
  • 举报
回复
采用CString中的GetBuffer函数,将CString转换成char*

13,826

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧