Problem on char on different windoes machine



  • hello i have a program where i write a QString like "this is my string"+char(001), in the computer where i compile(win xp) the program the char(001) is recognized but in another win pc(with xp) the char(001) is not recognized.

    Have you got some idea?

    Thanks

    Luca



  • Could you please post some actual code?

    Also, did you look into using QChar?



  • yes i have try with qchar but with same result
    the code is very easy:
    @if (resume == true){
    frase_conferma = "PRIVMSG "
    + libreria
    +" :"
    +char(001)
    +"DCC RESUME "
    +nome
    +" "
    +porta
    +" "
    +QString::number(lunghezza_esistente)
    +char(001)
    +"\n";
    @

    thanks

    Luca

    Edit: make code more readable; Andre



  • But, what kind of thing is frase_conferma? Is that a QString, or something else?



  • frase_conferma is a QString that i send with QTcpSocket in this way:
    socket.write(frase_conferma.toLatin1());//i have try also to ascii
    in linux windows and mac it works, but just in one windows machine i have no error but the char(001) is not send.
    Thanks

    Luca



  • How did you conclude that it did not work? Did you inspect the actual frase_conferma string before sending it? Just trying to help you pinpoint the precise point of failure here...

    Note that both toLatin1() and toAscii() may be dangerous to use, as you seem to use data in that string that comes from user input directly or indirectly. What happens if one or more of these strings contain characters from another character set?


Log in to reply
 

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