您的位置:首页 > 编程语言 > C语言/C++

MFC学习笔记之VC++ Debug Assertion Failed! 错误(File: strex.cpp Line: 690)

2015-01-10 20:19 816 查看
转载:http://blog.sina.com.cn/s/blog_8a7012cf0101es10.html

问题(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);

**********************解决方法********************************

官方说明:在
Strex.cpp,CString::Format 与行 690 断言的 BUG
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: