PDA

View Full Version : How to convert Little Endian(CAN Frame data) to Big Endian Format of C++ with Qt



npatil15
17th January 2019, 10:55
data[0] =0xA5;
data[1] =0xBC;
data[2] =0xFE;
data[3] =0xA5;
data[4] =0xB3;
data[5] =0xE1;
data[6] =0x29;
data[7] =0x70;

data[8] = {0xA5,0xBC,0xFE,0xA5,0xB3,0xE1,0x29,0x70};

Input: 700 [8] 0xA5 0xBC 0xFE 0xA5 0xB3 0xE1 0x29 0x70

Output: 0xBC 0xA5 0xA5 0xFE 0xE1 0xB3 0x70 0x29 (Currently i am getting this output) Little Endian format

Requested /Required output as : 0xA5 0xBC 0xFE 0xA5 0xB3 0xE1 0x29 0x70 Big Endian Format

Lesiok
17th January 2019, 11:09
Endian convertion (http://doc.qt.io/qt-5/qtendian.html)