Originally Posted by
anda_skoa
readLine(), reads, as it says, a line. So until an "end of line" character.
If your data is mp3 data, then it is not text, so you shouldn't be treating it like text.
If your want to read all data that is available at this point, use readAll()
Cheers,
_
char buffer[2048];
qint64 size = reply->read(buffer, sizeof(buffer));
buf.write(buffer, size);
char buffer[2048];
qint64 size = reply->read(buffer, sizeof(buffer));
buf.write(buffer, size);
To copy to clipboard, switch view to plain text mode
qa=reply->readAll();
buf.write(qa.data(),qa.size() );
QByteArray qa;
qa=reply->readAll();
buf.write(qa.data(),qa.size() );
To copy to clipboard, switch view to plain text mode
qa = reply->read(16 * 1024);
buf.write(qa.data(),qa.size());
mp3file.writeRawData(qa.data() ,qa.size());
QByteArray qa;
qa = reply->read(16 * 1024);
buf.write(qa.data(),qa.size());
mp3file.writeRawData(qa.data() ,qa.size());
To copy to clipboard, switch view to plain text mode
void MainWindow::downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
{
qa = reply->read(bytesReceived);
buf.write(qa.data(),qa.size());
mp3file.writeRawData(qa.data() ,qa.size());
}
void MainWindow::downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
{
QByteArray qa;
qa = reply->read(bytesReceived);
buf.write(qa.data(),qa.size());
mp3file.writeRawData(qa.data() ,qa.size());
}
To copy to clipboard, switch view to plain text mode
no difference,always mp3 data broken
but writing mp3 from static files(from url) goes well!
Bookmarks