Results 1 to 4 of 4

Thread: convert from little endian to big endian

  1. #1
    Join Date
    Jan 2009
    Posts
    54
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default convert from little endian to big endian

    Hello.

    I am sending datas from a qt-program ,running on a Windows machine, to a VxWorks machine.

    I am using QtcpSocket and i would like to know how can i convert from little endian to big endian and viceversa? Because each machine uses different endianness.

    Cheers

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: convert from little endian to big endian

    see qFromBigEndian() in qtglobal etc

    HTH

  3. #3
    Join Date
    Jan 2009
    Posts
    54
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: convert from little endian to big endian

    ok, thank you, i didnt kown these functions.

    But as I could read, this function can only convert a interger like quint16, quint32,.. Whats happen if i want to convert a qstring or a char*? How could i do it?

    The function which i am going to need is qtobigendian(T src, uchar m);

  4. #4
    Join Date
    Jan 2009
    Posts
    54
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: convert from little endian to big endian

    I am going to redefine the question becuase i didnt mention that i am sending the datas by qdatastream.

    I am sending the data from a little endian machine to a big endian, but i have read that qdatastream is setted in bigEndian by default , so isnt it neccessary tranform the datas alocated in little endian to big endian? because i understand that this is done by qdatastream type in default mode.

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.