CString.Format调用失败另一例(buffer too small vsprintf.c Line:244)
来源:互联网 发布:python采集图片教程 编辑:程序博客网 时间:2024/06/09 16:52
之前遇到如下一个问题——
程序运行出错:f:\dd\vctools\crt_bld\self_x86\crt\src\vsprintf.c Line:244”
Expression:("Buffer too small", 0).
最初以为是自己程序中sprintf使用不当造成的,就是就Grep出所有的sprintf,一个一个查,还是没有查出问题所在。
过了许久,已经忘了是哪个线索让我查出来是CString.Format时使用自身作为参数而调用失败了。(奇怪的是这个失败并不总会发生。我们程序中“隐藏”的这个问题年初就存在,可一直没有被发现过,而且可以肯定这段代码测试时被多次执行过。更奇怪的是,这个问题是两个团队几乎同时发现的。难道下面说的“不可预测”还与系统时间有关吗?至今无解!)
MSDN中对这个错误使用有过特别的记载——
The call will fail if the string object itself is offered as a parameter to Format. For example, the following code will cause unpredictable results:
CAtlString str = _T("Some Data");str.Format(_T("%s%d"), str, 123); // Attention: str is also used in the parameter list.
参考阅读——
1. 《 CString.Format使用一例》 http://blog.csdn.net/mxclxp/article/details/7393237
2. 《vc中CString::Format出现的Buffer too small错误(转)》 http://blog.csdn.net/zhulingfeng8726/article/details/7077341
- CString.Format调用失败另一例(buffer too small vsprintf.c Line:244)
- CString.Format报Buffer too small问题
- CString.Format报Buffer too small问题
- CString.Format报Buffer too small问题
- CString::Format出现的Buffer too small错误
- vc中CString::Format出现的Buffer too small错误(转)
- vc中CString::Format出现的Buffer too small错误(转)
- char* 转CString CString::Format出现的Buffer too small错误
- str.Format 错误 Buffer too small
- buffer too small
- buffer too small
- Buffer is too small
- c++ buffer is too small
- 关于sprintf_s,弹出Expression:(“Buffer too small”,0)
- strcpy_s Buffer is too small 出错根本原因
- xsql---Buffer too small for record data
- C中strcpy_s出现“buffer is too small …… ”问题
- VC程序提示 Expression:("Buffer too small",0) 错误
- SSH整合笔记
- 数据结构 -链表反转问题
- Win7 x64下配置apache和php
- 创新工场笔试
- Qt学习2——对话框改写
- CString.Format调用失败另一例(buffer too small vsprintf.c Line:244)
- [转载]Elsevier上发表论文的若干要求
- c primer plus chapter6
- iterator_traits( 转)
- 大学毕业后拉开差距的真正原因 《毕业5年决定你的一生》
- 传智博客JAVA基础第八天
- C#respnse 跳转到指定frame
- 配接器(包括仿函数),萃取器、分配器、迭代器
- 磁盘配额(quota)