Results 1 to 12 of 12

Thread: Read QString from file

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2010
    Posts
    22
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Read QString from file

    I did use QDomDocument to write it and I tried to use QXmlStreamReader to read it back. It was getting more complex to read it than I needed it to be. But anyways it reads and writes fine in my Qt app using QDataStream. I'm just having problems with my MapReader component in my game.

    I opened my saved file in a hex editor and got this:

    Image removed

    This is what I have in the debugger in Visual Studio:

    Image removed

    Does this look correct?
    Last edited by wysota; 16th March 2011 at 23:23. Reason: removed URLs

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Read QString from file

    Quote Originally Posted by justin123 View Post
    I did use QDomDocument to write it and I tried to use QXmlStreamReader to read it back.
    So why didn't you use QDomDocument for reading as well?

    But anyways it reads and writes fine in my Qt app using QDataStream. I'm just having problems with my MapReader component in my game.
    The thing is QDataStream uses a custom protocol which you have to implement if you want to do the i/o without Qt. It might be easier for you to settle either on a custom binary format or use xml (you can always encode images and other binary stuff using base64 encoding or something similar.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 3
    Last Post: 28th March 2009, 16:37
  2. is qt phonon can read realmedia file and divx file
    By fayssalqt in forum Qt Programming
    Replies: 1
    Last Post: 27th January 2009, 16:42
  3. How can I read binary data to QString?
    By zolookas in forum Newbie
    Replies: 2
    Last Post: 29th July 2008, 21:03
  4. QDataStream and QHash<QString,QVariant> crash on read
    By ^NyAw^ in forum Qt Programming
    Replies: 1
    Last Post: 15th July 2008, 13:14
  5. Read binary file and convert to QString
    By jaca in forum Qt Programming
    Replies: 12
    Last Post: 14th June 2008, 00:05

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.