Is it possible to use cin
in Qt? I can use cout
but cannot find examples of how to use cin
within a Qt console application.
Is it possible to use cin
in Qt? I can use cout
but cannot find examples of how to use cin
within a Qt console application.
I tested out Kaleb Pederson's answer, and found a more consise way than the solution he presented (though I have to thank him for pointing me to the right direction):
QTextStream qtin(stdin);
QString line = qtin.readLine(); // This is how you read the entire line
QString word;
qtin >> word; // This is how you read a word (separated by space) at a time.
In other words, you don't really need QFile as your middleman.