更正错误
Correct the mistake
本文关键字:错误 更新时间:2023-10-16
为什么不编译此代码?
TextMem tmem, *fp = &tmem;
char *_res = new char[textbuf.mLength + 1];
tmem.Open(textbuf, TextStream::READ | TextStream::EOL_CRLF | TextStream::EOL_ORPHAN_CR, CP_UTF8);
tmem.Read(_res, textbuf.mLength);
tmem.Close();
char dbg[256];
sprintf(dbg, "mBuffer is %X, _res is %X", textbuf.mBuffer, _res);
MessageBox(NULL, dbg, "debug", MB_OK);
for (size_t i = 0; i < strlen(_res); i++)
_res[i] ^= 168;
sprintf(dbg, "mBuffer is %X, _res is %X", textbuf.mBuffer, _res);
MessageBox(NULL, dbg, "debug", MB_OK);
textbuf.mBuffer = _res;
textbuf.mLength = _ind;
sprintf(dbg, "mBuffer is %X, _res is %X", textbuf.mBuffer, _res);
MessageBox(NULL, dbg, "debug", MB_OK);
tmem.Open(textbuf, TextStream::READ | TextStream::EOL_CRLF | TextStream::EOL_ORPHAN_CR, CP_UTF8);
编译器在"sprintf"中发现错误,我应该怎么做才能消除这个错误?
我使用 Microsoft Visual Studio 2010
我使用Visual Studio 2010 Microsoft
也许你应该用_sprintf
替换sprintf
因为你的编译器。
我在那里没有看到任何错误。
相关文章:
- 警告处理为错误这里有什么问题
- "error: no matching function for call to"构造函数错误
- boost::进程间消息队列引发错误
- C++,OpenCV,尝试显示图像时"OpenCV(4.3.0) Error: Assertion failed (size.width>0 && size.height>0)"此错误
- 有关插入适配器的错误。[错误]请求从 'back_insert_iterator<vector<>>' 类型转换为非标量类型
- QT在错误的班级中寻找空位
- vector.resize()中的分配错误
- 代码在main()中运行,但在函数中出现错误
- 释放错误后堆使用
- (C++)分析树以计算返回错误值的简单算术表达式
- Project Euler问题4的错误解决方案
- 我的字符计数代码计算错误.为什么
- 从"int*"强制转换为"unsigned int"会丢失精度错误
- 尝试导入pybind-opencv模块时出现libgtk错误
- CMake项目Boost库错误:Boost/config/compiler/gcc.hpp:165:10:致命错误:cs
- 在某些循环内使用vector.push_back时出现分段错误
- MSVC多行宏编译器错误
- 静态数据成员的问题-修复链接错误会导致编译器错误
- 为什么在运行时没有向我们提供有关分段错误的更多信息?
- 错误:未在此范围内声明'reverse'