QNetworkReply and file downloading problem



  • Hello,
    I experience a strange situation:
    @this->connect( this->networkManager, SIGNAL( finished( QNetworkReply* ) ), this, SLOT( onDownloadingFinished( QNetworkReply* ) ) );

    void UpdateMgr::onDownloadingFinished( QNetworkReply* reply )
    {
    if( reply->error() == QNetworkReply::NoError )
    {
    qDebug() << "Size of downloaded file:" << reply->size();
    qDebug() << "Size of saved file:" << reply->readAll().length();
    }
    @
    Output:
    Size of downloaded file: 11902976
    Size of saved file: 11894784

    Casue of that I det damaged file. Why????



  • You have to append reply->readAll to your file on each readyRead signal and close your file when the finish signal comes as it may not come all in one big chunk.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.