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. Getting error in encoding data?
Forum Updated to NodeBB v4.3 + New Features

Getting error in encoding data?

Scheduled Pinned Locked Moved General and Desktop
7 Posts 3 Posters 2.3k 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.
  • P Offline
    P Offline
    pratik041
    wrote on last edited by
    #1

    I have tried the example below
    @ QFile file("doc.txt");
    file.open(QIODevice::WriteOnly);
    QDataStream out(&file); // we will serialize the data into the file
    out << "welcome to the Qt World"; // serialize a string
    file.close();
    @
    but i am not getting the encoded data in the file.

    Error is "could not decode "filename" with system encoding.

    Pratik Agrawal

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

      I doubt, that "doc.txt" is the name you gave to the file constructor.

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

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pratik041
        wrote on last edited by
        #3

        [quote author="Volker" date="1323089566"]I doubt, that "doc.txt" is the name you gave to the file constructor.[/quote]

        It is a text file.

        Pratik Agrawal

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

          Me: "I doubt that the sky is green"
          You: "The water is cold"

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

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #5

            [quote author="Volker" date="1323093010"]Me: "I doubt that the sky is green"
            You: "The water is cold"
            [/quote]

            Are you in a philosophical mood today, Volker? ;-)

            1 Reply Last reply
            0
            • P Offline
              P Offline
              pratik041
              wrote on last edited by
              #6

              What is the error in that i am getting the original data in the file not the encoded one? There is some
              system dependencies or something else.

              [quote author="Volker" date="1323089566"]I doubt, that "doc.txt" is the name you gave to the file constructor.[/quote]
              if "doc.txt" name is taking as file constructor name then what i should write instead of that line to avoid that.

              [quote author="Volker" date="1323093010"]Me: "I doubt that the sky is green"
              You: "The water is cold"
              [/quote]

              Sorry, i understood that differently.

              Edit: I merged your three replies into one. Please don't just reply to yourself; Andre

              Pratik Agrawal

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

                The literal string "could not decode" is not used in Qt sources (with an exception of phonon sources, which do not apply here). I don't see any connection to Qt at the moment.

                Oh, and BTW: decoding usually is done in a read step. Your snippet just writes...

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

                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