请帮助消息框不接受参数
Please help message box doesnt accept parameter
我有这个函数,但它不起作用:
std::string s(Buffer);
std::string::size_type k = 0;
while ((k = s.find('"', k)) != s.npos) {
s.erase(k, 1);
}
while ((k = s.find(' ', k)) != s.npos) {
s.erase(k, 1);
}
::MessageBoxA(NULL, s.c_str, "Print recevied buffer", MB_ICONINFORMATION);
我有一个缓冲区(这是一个互联网页面),我想解析它以删除所有空格和字符"。我尝试了很多解决方案,但没有一个有效。
这个说我应该创建一个对字符串的引用,但我不明白这意味着什么。
你写了s.c_str
(命名函数指针)而不是s.c_str()
(实际调用函数)。
您的实际问题涉及使用k
而不重置它。
while ((k = s.find('"', k)) != s.npos) {
s.erase(k, 1);
}
k = 0; //you need to reset k in order to properly remove spaces
while ((k = s.find(' ', 0)) != s.npos) {
s.erase(k, 1);
}
相关文章:
- 函数不接受 X 参数,函数使用默认参数
- 为什么不接受具有默认分配参数的函数作为 0-arg 生成器?
- 函数不接受 C++ 参数
- SQLHANDLE-Parameters:函数不接受x个参数(但实际上确实如此)
- 函数不接受 1 个参数
- 为什么析构函数不接受C++中的参数?
- 为什么C++可变参数模板不接受 iostream 值作为参数?
- C++:将引用作为参数传递,但该函数不接受引用作为参数
- 我的构造函数方法不接受参数(DirectX / Windows)
- 可变参数模板化构造函数不接受 x 参数
- 为什么 std::is_invocable 不接受非类型模板参数
- 错误 C2660:'MouseListener::MousePressed':函数不接受 4 个参数
- 不接受静态成员函数作为 constexpr 参数
- 方法指针映射,编译器说他们不接受任何参数
- GCC 不接受默认模板参数中的包扩展
- 为什么Clang和VS2013接受移动大括号初始化的默认参数,而不接受GCC 4.8或4.9
- C++ 中的特征库给出错误 C2660:"特征::矩阵基<Derived>::特征值":函数不接受 2 个参数
- Execlp()不接受参数列表,只接受命令.UNIX/LINUX编程
- QtConcurrent::map 不接受参数
- 请帮助消息框不接受参数