c++ - std::cout 在 QNX 中 \n 之后不打印字母
问题描述
我想打印存储在单个字符串中的项目列表。我不知道为什么最后一项被跳过了!
你知道为什么吗?
#include <iostream>
#include <string>
int main() {
std::string string_test{"Item1\nItem2\nItem3"};
std::cout << string_test;
return 0;
}
输出是:
Item1
Item2
解决方案
这是 QNX 版本 7.0.3 上的行缓冲流输出中报告的错误。