PDA

View Full Version : convert from little endian to big endian



adamatic
1st March 2009, 19:40
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

caduel
1st March 2009, 20:09
see qFromBigEndian() in qtglobal etc

HTH

adamatic
2nd March 2009, 07:50
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);

adamatic
2nd March 2009, 08:52
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.