CString类 , Format 成员函数

cpp20071101 2007-12-04 03:34:07
CString CHOOL_FIVEDlg :: formatsend ( int x , int y ){
CString outbuf = "POS" ,strtemp ;
wchar_t s ;
s = 'a'+ x ;
strtemp.Format ( "%c",s ) ;
outbuf += strtemp ;
s = 'o' + y ;
strtemp.Format ( "%c",s ) ;
outbuf += strtemp ;
return outbuf ;
}



错误:
d:\my documents\visual studio 2005\projects\hool_five\hool_five\hool_fivedlg.cpp(479) : error C2440: “=”: 无法从“int”转换为“wchar_t *”
从整型转换为指针类型要求 reinterpret_cast、C 样式转换或函数样式转换
d:\my documents\visual studio 2005\projects\hool_five\hool_five\hool_fivedlg.cpp(481) : error C2664: “void ATL::CStringT<BaseType,StringTraits>::Format(const wchar_t *,...)”: 不能将参数 1 从“const char [3]”转换为“const wchar_t *”
with
[
BaseType=wchar_t,
StringTraits=StrTraitMFC_DLL<wchar_t>
]
与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换
d:\my documents\visual studio 2005\projects\hool_five\hool_five\hool_fivedlg.cpp(485) : error C2440: “=”: 无法从“int”转换为“wchar_t *”
从整型转换为指针类型要求 reinterpret_cast、C 样式转换或函数样式转换
d:\my documents\visual studio 2005\projects\hool_five\hool_five\hool_fivedlg.cpp(487) : error C2664: “void ATL::CStringT<BaseType,StringTraits>::Format(const wchar_t *,...)”: 不能将参数 1 从“const char [3]”转换为“const wchar_t *”
with
[
BaseType=wchar_t,
StringTraits=StrTraitMFC_DLL<wchar_t>
]
与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换


麻烦大家帮我找出问题来,谢谢!到底杂回事儿,有够郁闷,Format到底杂用? :(
...全文
141 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
cpp20071101 2007-12-04
  • 打赏
  • 举报
回复
散人大哥,不要散人阿 ,哎 ~~~
cpp20071101 2007-12-04
  • 打赏
  • 举报
回复
char s , 就更不对了 ,我就是从char 改到 wchar_t 的 ^_^
ouyh12345 2007-12-04
  • 打赏
  • 举报
回复
char s;

33,311

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 新手乐园
社区管理员
  • 新手乐园社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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