The code is simple
#include <iostream>
#include <unistd.h>
using namespace std;
int main()
{
for(int i = 0; i < 3; ++i)
{
cout << "1 "; cout.flush();
sleep(1);
}
}
while in .pro file
QT += core
TARGET = ProjectName
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TEMPLATE = app
If the output goes into Qt Creator "application output" (the place under source code place by default), every "1" starts from a new line.
If I compile and execute separate *.cpp file in Ubuntu Terminal using g++, it works in a proper way.
If I create a new project in Qt Creator and output goes into Qt Creator console (new window with black background), it works in a proper way.
Well, why does cout.flush() cause a newline in the first case?