File:f:\rtm\vctools\crt_bld\self_x86\crt\src\vswprint.c
Line:280
Expression:("Buffer too small",0)
For information on how your program can cause an assertion failure seethe Visual C++ documentation on asserts
(Press Retry to debug the application)
cstring str;
str.format("asd....");
setdlgitemtext(,str);
在文本框控件里,setdlgitemtext,有时会出现这种情况,都有什么原因?
5 个解决方案
#1
网上说,用一个变量format会出现这样,你可以让str = "asd....";或用str1 = "asd...."再用str.format( "%s", str1 );之类的做法。
#2
同意 ++
#3
你用sprintf等api格式化字符串的时候,数组有越界等.
#4
The call will fail if the string object itself is offered as a parameter to Format. For example, the following code:
CString str = "Some Data";
str.Format("%d%d", str, 123); //Attention: str is also used in the parameter list.
will cause unpredictable results.
为了避免这种无法预见的问题,最好不要采取将字符串本身作为参数作为Format的参数,可以另外定义一个CString变量:
cstring str,strTmp;
strTmp="asd....";
str.format("%s",strTmp);
这样问题就解决了。
CString str = "Some Data";
str.Format("%d%d", str, 123); //Attention: str is also used in the parameter list.
will cause unpredictable results.
为了避免这种无法预见的问题,最好不要采取将字符串本身作为参数作为Format的参数,可以另外定义一个CString变量:
cstring str,strTmp;
strTmp="asd....";
str.format("%s",strTmp);
这样问题就解决了。
#5
好吧,目前只能这样了,谢谢楼上各位
#1
网上说,用一个变量format会出现这样,你可以让str = "asd....";或用str1 = "asd...."再用str.format( "%s", str1 );之类的做法。
#2
同意 ++
#3
你用sprintf等api格式化字符串的时候,数组有越界等.
#4
The call will fail if the string object itself is offered as a parameter to Format. For example, the following code:
CString str = "Some Data";
str.Format("%d%d", str, 123); //Attention: str is also used in the parameter list.
will cause unpredictable results.
为了避免这种无法预见的问题,最好不要采取将字符串本身作为参数作为Format的参数,可以另外定义一个CString变量:
cstring str,strTmp;
strTmp="asd....";
str.format("%s",strTmp);
这样问题就解决了。
CString str = "Some Data";
str.Format("%d%d", str, 123); //Attention: str is also used in the parameter list.
will cause unpredictable results.
为了避免这种无法预见的问题,最好不要采取将字符串本身作为参数作为Format的参数,可以另外定义一个CString变量:
cstring str,strTmp;
strTmp="asd....";
str.format("%s",strTmp);
这样问题就解决了。
#5
好吧,目前只能这样了,谢谢楼上各位