PDA

View Full Version : read input string --> text mode



eleanor
25th October 2007, 18:58
Hi, I want to read input from the user in text mode QT application and this doesn't stop the program to enter the name:



QString enteredName;
QFile inputFile,outputFile;
cout << "Enter the name you want to search for: ";
inputFile.open(stdin,QIODevice::ReadOnly);



I didn't add the line where I want to write the contents into enteredName...how can I do that?

jpn
25th October 2007, 19:08
The following example is from QTextStream docs:


QTextStream stream(stdin);
QString line;
do {
line = stream.readLine();
} while (!line.isNull());