Results 1 to 3 of 3

Thread: Problem with QHttp's data encoding.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Jul 2010
    Posts
    30
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem with QHttp's data encoding.

    So I have changed QTextStream to file.write(http->readAll()) but still after download is compile I'm not able to open the archive (Archive is corrupt~.).
    Here's my current code:
    Qt Code:
    1. void Updater::finishDownload()
    2. {
    3. QFile file("Launcher.tmp");
    4. if( file.exists() )
    5. file.remove();
    6.  
    7. if( !file.open(QIODevice::WriteOnly | QIODevice::Text) ) {
    8. QMessageBox::critical(this, "Updater", "Failed to open file.");
    9. return;
    10. }
    11.  
    12. file.write(http->readAll());
    13. file.close();
    14.  
    15. QProcess proc;
    16. proc.start("7z.exe", params);
    17.  
    18. //file->remove();
    19. updateCurrentVersion();
    20. QMessageBox::information(this, "Updater", "New version has been downloaded.");
    21.  
    22. _parent->show();
    23. close();
    24. }
    To copy to clipboard, switch view to plain text mode 

    Any other tips?

    @Edit:
    Oh, dumb me. QIODevice::Text as you said, of course. Problem solved, thanks Chris.
    Last edited by Diath; 3rd July 2011 at 22:09.

Similar Threads

  1. encoding problem
    By lexqqq in forum Qt Programming
    Replies: 1
    Last Post: 26th November 2010, 23:41
  2. Replies: 0
    Last Post: 21st July 2010, 21:55
  3. Encoding problem with QTextEdit
    By alexandernst in forum Newbie
    Replies: 3
    Last Post: 2nd September 2009, 11:49
  4. QTableView encoding problem
    By SudaNix in forum Newbie
    Replies: 7
    Last Post: 26th February 2008, 14:19
  5. qt and mysql encoding problem
    By ferasodh in forum Qt Programming
    Replies: 1
    Last Post: 8th September 2007, 09:48

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.