Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] Problem with QDataStream on Mac

[Solved] Problem with QDataStream on Mac

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 3.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gkroeger
    wrote on last edited by
    #1

    I am reading a binary data file using QDataStream on a Mac. QT4.7

    I open a QFile (with file dialog) then create a QDataStream from it. Set version, floating point precision.

    When I read the file, bytes with a hex value of 0D are skipped. This happens regardless of whether I use a readRawData method or whether I read individual values using >> operators?

    So 0D is ASCII CR which is the line termination char on Mac OS... but this shouldn't be interpreted by QDataStream?

    Am I missing something obvious?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      gkroeger
      wrote on last edited by
      #2

      Just compiled and ran the project on Windows 7 and had the same problem. I am doing a readRawData into a char buffer[] and comparing the in memory buffer contents to the results of
      a hexdump of the file.

      Glenn

      1 Reply Last reply
      0
      • G Offline
        G Offline
        goetz
        wrote on last edited by
        #3

        Can you post a test snippet, please.

        http://www.catb.org/~esr/faqs/smart-questions.html

        1 Reply Last reply
        0
        • G Offline
          G Offline
          gkroeger
          wrote on last edited by
          #4

          Volker:

          Thanks for the reply... but I just found the problem... it was in the underlying QFile, buried deep in a dialog box code, the underlying IODevice was getting set to TEXT mode.

          Problem Solved... my bad.

          Glenn

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goetz
            wrote on last edited by
            #5

            Oh... that old text mode for files ... always creating some fun :-)

            You can mark the thread as solved by prepending [Solved] to the topic. Just click on the edit link below your username right of the original post.

            http://www.catb.org/~esr/faqs/smart-questions.html

            1 Reply Last reply
            0
            • G Offline
              G Offline
              gkroeger
              wrote on last edited by
              #6

              Done, thanks.

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved