I have been wondering if it is possible to collect user input using the qDebug() statement in Qt C++.
I tried do it like in the std C++ code like:
qDebug() >> myvar;
but it didn't work.
How can I read from stdin using Qt?
qDebug is used to make output to stderr. If you want to read from stdin using Qt, you should use QTextStream:
#include <stdio.h>
QTextStream in(stdin);
QString line;
in >> line;
No, it isn't possible. qDebug provides only output stream for debugging informations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With