PDA

View Full Version : QTextStream problem



^NyAw^
18th June 2007, 18:05
Hi,

I'm having problems with QTextStream



bool b1 = m_qFile.isOpen(); //returns true
m_qStream.setDevice(&m_qFile); //QTextStream
m_qStream2.setDevice(&m_qFile); //QDataStream

QStringList qList = m_qText.split(QString(" "));
QString qText;
for (int i=0; i<qList .count(); i++)
{
qText= qList.at(i);
m_qStream << qText; //It don't write anything
m_qStream2 << qText; //It writes the QString
}
m_qFile.flush();
m_qFile.close();


If I use QTextStrem, it don't write anything to the file but using QDataStream it writes the QString data into the file. I don't understand what it's happening. :(

Thanks,

wysota
19th June 2007, 08:57
Could you provide a minimal compilable example that reproduces the problem?

^NyAw^
19th June 2007, 09:40
Hi,
I don't understand what is happenning. I have made a simple example to get it to you and it works but in my application still not working.

I'm using QTextStream and QDataStream into a QThread derivated class. I have another application that it works. :confused:

Thanks,

^NyAw^
19th June 2007, 09:50
Hi,

I have made another test. My code doesn't work if I insert it into a "switch-case" statment. I have removed "switch" statment and now it works.

Thanks for replying,