I have started to teach myself Qt. I have, in the lack of a better assignment, given myself the task to wirte a small program that searches several text files for a specific phrase. So far I've run into a small problem with QTextStream. The idea is that the program asks the user if he wishes to view the files being searched in a TextEdit in the mainwindow. I just can't seem to get it done right
QStringList::Iterator it
= FilePath.
begin();
//FilePath holds the filepaths if (MsgBoxAnswer)
{
while(it != FilePath.end())
{
ui.txtOutput->append("Before TextStream"); //Test to see whether the program works so far
TextStream << *it;
while(!TextStream.atEnd())
{
ui.txtOutput->append("in TextStream"); //Test to see whether the program works so far
Line = TextStream.readLine(0);
ui.txtOutput->append(Line);
}
++it;
}
}
QStringList::Iterator it = FilePath.begin(); //FilePath holds the filepaths
QTextStream TextStream;
QString Line;
if (MsgBoxAnswer)
{
while(it != FilePath.end())
{
ui.txtOutput->append("Before TextStream"); //Test to see whether the program works so far
TextStream << *it;
while(!TextStream.atEnd())
{
ui.txtOutput->append("in TextStream"); //Test to see whether the program works so far
Line = TextStream.readLine(0);
ui.txtOutput->append(Line);
}
++it;
}
}
To copy to clipboard, switch view to plain text mode
What is the matter? The program never enters the while(!TextStream.atEnd()) loop
Bookmarks