Last active
August 29, 2015 14:16
-
-
Save e12e/f79e9f0e66ee3600e0aa to your computer and use it in GitHub Desktop.
Idiomatic way of writing eol and flushing stdout with qt5?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <QTextStream> | |
int main(int, char*[]) | |
{ | |
// Works, but is hacky (note: empty string): | |
// QTextStream(stdout) << "" << endl; | |
// Does not compile: | |
// QTextStream(stdout) << endl; | |
// Best? way (thanks to suy on #qt@freenode): | |
QTextStream out(stdout); | |
out << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To test:
mkdir qt
cd qt
wget https://gist.github.com/e12e/f79e9f0e66ee3600e0aa/raw/7ab8239060134601e93a0013706df638af0b3edf/qt.cpp
qmake -project
qmake -makefile
make
./qt # outputs empty line