滥用 istream&get
Misusing istream& get
我正在尝试制作一种从外部文件中提取电子邮件信息并将其存储在字符串中的方法。我正在使用 .get 提取字符,但我的调试器说:没有重载函数的实例与参数列表匹配。它还说它无法将第三个参数从 const char[2] 转换为 char。这似乎是一个快速解决方案,但我一直在玩弄参数,似乎无法弄清楚出了什么问题。
current->email_data.sent 是指向字符数组的指针。
另外,我不确定为什么我的代码在粘贴到此处时不会缩进。
int Classify::Load_email(char filename[]) {
email_node * current;
current = email_head;
ifstream source_file(filename);
if(email_head)
{
while(current->next) {
current = current->next;
}
}
else {
email_head = new email_node;
}
while(!source_file.eof()) {
source_file.get(current->email_data.sent, 200, "|");
}
};
在 basic_istream::get
的三参数重载中,最后一个参数是单个字符,而不是字符串。将"|"
替换为 '|'
。
相关文章:
- Cpp-Tuple使用带有变量的get
- 为什么istream不支持右值提取
- 将无符号char*转换为std::istream*C++
- 需要从 istream 和 ostream 派生 iostream
- 使用std::istream::peek()总是安全的吗
- 使用 istream 参数读取的 istream 函数
- 通过 get-Method 访问变量在类外不起作用
- istream std::cin如何修改自定义istream缓冲区
- 为什么无论你输入什么,这"while(cin.get(str,3))"只运行一次?
- Boost.Asio/OpenSSL HTTPS GET certificate trouble
- C++中是否有任何函数等同于python中字典的get函数?
- 为什么我在使用 istream 迭代器时会出现 seg 错误?
- 提取后返回换行符的C++istream.get()
- istream and cin.get()
- istream::operator>> 或 istream::get
- 由于 istream 中的杂散 导致 get () 的结果不正确,但 scanf() 或 cin 则不然
- 函数int get()和istream&get(char&c)有什么区别
- 滥用 istream&get
- Get an istream from a char*
- "istream::get"和"operator>>(istream&, char&)"之间的区别