以下给我奇怪的消息:
该消息出现在ifstream文本中(将其悬停时)
path是完整的Windows样式路径,例如:“C:\ t.txt”
void checkInput(string path)
{
ifstream text(path);
// "...<Error reading characters of string.>..."
if (text.is_open())
{
if (text.good())
...
完整的消息:
{_Filebuffer={_Set_eback=0xcccccccc <Error reading characters of string>.
_Set_egptr=0xcccccccc <Error reading characters of string>. ...} }
std::basic_ifstream<char,std::char_traits<char>> "
我尝试使用char *代替string和string.c_str。
不好。
谢谢答案,
即使我仍然收到此消息,代码似乎仍在运行。
以前我的代码中还有另一个错误。
我曾想删除它,但可能会知道此消息不会阻止代码运行。
最佳答案
关于c++ - 无法初始化ifstream “Error reading characters of string”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23223934/