加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

VC++ Debug Assertion Failed! 错误(File: strex.cpp Line: 690)

(2013-09-09 10:58:02)
标签:

vc

debug

strex.cpp

line690

assertionfailed

it

分类: C/VC
问题(File: strex.cpp Line: 690):
错误描述:在Debug模式下报错,Release模式下正常。

---------------------------
Microsoft Visual C++ Debug Library
---------------------------
Debug Assertion Failed!

Program: D:\Projects\20130906\HK-H英文\Debug\C100A.exe
File: strex.cpp
Line: 690

For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.

(Press Retry to debug the application)
---------------------------
终止(A)   重试(R)   忽略(I)   
---------------------------
错误原因:CString设计缺陷。
解决方法:在格式化浮点数时增加临时变量。格式化整数时不存在这个问题。

**********************会报错********************************
CString str;
str.Format("%.3f", 5.6);
str.Format("%-15s", str);
**********************会报错********************************

**********************正常********************************
CString str;
str.Format("%d", 5);
str.Format("%-15s", str);
**********************正常********************************

**********************解决方法********************************
CString str;
CString strTemp;
strTemp.Format("%.3f", 5.6);
str.Format("%-15s", strTemp);
**********************解决方法********************************

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有