社区
C++ 语言
帖子详情
CString::Format 问题?
swordsman
2011-08-10 11:31:41
①CString strTemp;
②m_ComboBox.ResetContent();//消除现有所有内容
③for(int i=1;i<=100;i++){
④ strTemp.Format(i);
⑤ m_ComboBox.AddString(strTemp);
⑥}
但执行到⑥时,问题出现了。请高手们帮我看看。谢谢!
...全文
103
6
打赏
收藏
CString::Format 问题?
①CString strTemp; ②m_ComboBox.ResetContent();//消除现有所有内容 ③for(int i=1;i<=100;i++){ ④strTemp.Format(i); ⑤m_ComboBox.AddString(strTemp); ⑥} 但执行到⑥时,问题出现了。请高手们帮我看看。谢谢!
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
6 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
swordsman
2011-08-10
打赏
举报
回复
[Quote=引用 4 楼 myangele 的回复:]
strTemp.Format(_T("%d"),i);
这样写就行了 。
[/Quote]
大哥你是对的。分给你了。
MyAngele
2011-08-10
打赏
举报
回复
或者打开你的工程属性里把使用unicode字符集去掉。
MyAngele
2011-08-10
打赏
举报
回复
strTemp.Format(_T("%d"),i);
这样写就行了 。
swordsman
2011-08-10
打赏
举报
回复
[Quote=引用 1 楼 downmooner 的回复:]
④ strTemp.Format("%d",i);
[/Quote]
编译错误:
1> CMColor.cpp
1>e:\vc++\ivrmaker\cmcolor.cpp(47): error C2664: “void ATL::CStringT<BaseType,StringTraits>::Format(const wchar_t *,...)”: 不能将参数 1 从“const char [3]”转换为“const wchar_t *”
1> with
1> [
1> BaseType=wchar_t,
1> StringTraits=StrTraitMFC_DLL<wchar_t>
1> ]
1> 与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换
1>
1>生成失败。
swordsman
2011-08-10
打赏
举报
回复
[Quote=引用 1 楼 downmooner 的回复:]
④ strTemp.Format("%d",i);
[/Quote]
这样写都编译不过去呀。大哥。我的VS2010
downmooner
2011-08-10
打赏
举报
回复
④ strTemp.Format("%d",i);
C
String
::
Format
问题
这个主要是VS与VC6.0的区别,c
string
::
format
语句对于C
String
::
format
, VC9里貌似必须用UNICODE转换,只要按照下面这样写就可以了。c
string
strtmp;strtmp.
Format
(_T("%c"),char * ) _T就是unicode的变换了
C
String
之
Format
!!
C
String
好是好用, 但用得不好,异常也不少,
Format
就是其中一项. MS现在有了单独的:
Format
()函数可以使用!! 修复: C
String
::
Format
提供断言失败,访问冲突 使用 C
String
::
Format
将导致下列选项之一: 断言失败: <application>: 文件 strex.cpp 线条 36...
C
String
.
Format
报Buffer too small
问题
转载▼ 标签: c
string
format
error 出现“Expression Buffer too small"的错误提示. 上网查找了下,说可能是C
String
::
Format
这个函数出现的
问题
. 例如这句代码: m_strFBL.
Format
("%s(放大约%d倍
vc中C
String
::
Format
出现的Buffer too small错误(转)
感谢原作者!今天我发现了一个类似的错误,都怪我,看MSDN没注意到Attention,以为是个实例,直接拿来用!呵呵,下次注意点! 原文如下(转自http://yiyunscu.blog.163.com/blog/static/36263320201091010349294/): 这段时间一直在忙项目,也没有时间来博客把这段时间的东西整理下粘贴上来,只是今天晚上把手上的工作调试完成了,上了博客
C++ 语言
65,210
社区成员
250,514
社区内容
发帖
与我相关
我的任务
C++ 语言
C++ 语言相关问题讨论,技术干货分享,前沿动态等
复制链接
扫一扫
分享
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++
技术论坛(原bbs)
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
请不要发布与C++技术无关的贴子
请不要发布与技术无关的招聘、广告的帖子
请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下
试试用AI创作助手写篇文章吧
+ 用AI写文章