Getting error in encoding data?



  • 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.



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



  • [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.



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



  • [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? ;-)



  • 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



  • 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...


Log in to reply
 

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