Search code examples
c++stringqnx

std::cout doesn't print letters after \n in QNX


I want to print a list of items stored in a single string. I don't know why the last item is skipped!

Do you have an idea why?

#include <iostream>
#include <string>

int main() {
  std::string string_test{"Item1\nItem2\nItem3"};
  std::cout << string_test;

  return 0;
}

The output is:

Item1
Item2

Solution

  • It is a reported bug in line-buffered stream output on QNX version 7.0.3.

    Source