我在while循环中使用std :: getline,并使用cout打印输出,发现当我打印输出时,我的行开头被截断:
正常工作:
std::string line;
while(std::getline(csv, line)) {
std::cout << line << std::endl
}
预期效果未能实现,会切掉我这行文字的前两个字符。
std::string line;
while(std::getline(csv, line)) {
std::cout << line << " " << std::endl
}
我以前从没注意到这种行为,为什么现在会发生呢?
cout
有问题而不是line
实际上缺少了预期的字符? - pickypg