Re: QTextStream with QString
This might help to understand things better.
Re: QTextStream with QString
Quote:
Originally Posted by munna
This might help to understand things better.
The Qt Documentation is my first ressource if I want to look up something, so I've read that already. I don't see an answer to my question in there.
Re: QTextStream with QString
Try calling QTextStream::flush() to flush the buffered data waiting to be written.
Re: QTextStream with QString
That's weird, when I run it, the output I get is:
1.11 Freunde
2.11 Freunde
which is what I expect. (Running WinXP, Qt 4.1.3)
The docs say that QTextStream::flush() has no effect when QTextStream operates on a string... Maybe your cout just needs to be flushed? weird.
Re: QTextStream with QString
Thanks, but neither
Code:
ts<<11<<" Freunde";
ts.flush();
std::cout<<"1."<<ts.readAll().toStdString()<<'\n'<<"2."<<s.toStdString();
nor
Code:
ts<<11<<" Freunde";
std::cout<<"1."<<ts.readAll().toStdString()<<'\n'<<"2."<<s.toStdString();
std::cout.flush();
nor a combination ob both helps. But perhaps we are on the right track :rolleyes:
I'm using Qt 4.1.4 on Linux.
Re: QTextStream with QString
Why "2." doesn't even show in your output?
What happens if you split the cout into two lines?
std::cout<<"1."<<ts.readAll().toStdString()<<'\n';
std::cout <<"2."<<s.toStdString();
Re: QTextStream with QString
What about if you try to use qDebug() for outputting?
Code:
#include <QtDebug>
qDebug() <<"1."<<ts.readAll()<<'\n'<<"2."<<s;