QTextStream crashes when reading a file
-
Hello,
I have the following code:
QFile fFile(strFile); if(!fFile.open(QIODevice::ReadOnly | QIODevice::Text)) qDebug() << "can't read"; else { qDebug() << "executed"; QTextStream in(&fFile); qDebug() << "not executed"; while(!in.atEnd()) { qDebug() << in.readLine(); } fFile.close(); }
Most of the time when the code is executed it crashes at the line QTextStream in(&fFile).
The point is that I use the same code somewhere else to read other files and it is working absolutely fine. It is also very strange, that it works in very rare cases. There is definitively no problem with the file itself because there error occurs independent from what "strFile" contains (as long as it is a valid file).
I really don't know what's going on here. The underlaying OS is Windows 7.Any ideas?
-
oooooh well :(
Sorry guys, false alarm. I found the mistake somewhere else in the code. Wanted to write on a position in an array that wasn't available so far. Don't know how I made the connection to QTextStream.
I didn't see the forest for the trees.Has been a long day, I should go home now. Sorry :)