12
Yes, it's possible and works as expected although you can do things, like use threads, that may cause problems with this approach.
However, I would recommend a more idiomatic (Qt) way to read from stdin:
QString yourText;
QFile file;
file.open(stdin, QIODevice::ReadOnly);
QTextStream qtin(&file);
qtin >> yourText;