Groan... Here we go again.
The QHttp class is obsolete. Do not use it in new code. Why do you continue to ignore advice to move to using QNetworkAccessManager and QNetworkReply?
The problem is trivially easy even using the wrong API. You could do this to read exactly a number of bytes:
// QHttp *http;
// QByteArray ba;
qint64 available = http->bytesAvailable();
ba.resize(available);
qint64 justRead = http->read(ba.data(), available);
if (justRead != available)
// error condition of some sort
...;
// QHttp *http;
// QByteArray ba;
qint64 available = http->bytesAvailable();
ba.resize(available);
qint64 justRead = http->read(ba.data(), available);
if (justRead != available)
// error condition of some sort
...;
To copy to clipboard, switch view to plain text mode
or more simply this in your readyRead() signal handler (which is called only when there is data available) or requestFinished() signal handler:
QByteArray ba = http->readAll();
To copy to clipboard, switch view to plain text mode
Of course, if you bothered to read your previous posts on the topic you might worked this out weeks ago.
Bookmarks