Hi,
I'm trying to send a message through a TCP socket. The message contains numbers:
char* pacDades = new char[50];
int iLong = 25;
pacData[0] = (char)iLong;
pacData[1] = '$';
pacData[2] = '0';
pacData[3] = '$';
quint16 qNum = 150;
quint8 qNumFotosMSB = (qNum >> 8);
qNumMSB += 48;
quint8 qNumFotosLSB = qNum;
qNumLSB += 48;
pacData[4] = (char)qNumMSB;
pacData[5] = (char)qNumLSB;
qint64 qNumBytes = m_qSocket.write(pacData,qLong);
char* pacDades = new char[50];
int iLong = 25;
pacData[0] = (char)iLong;
pacData[1] = '$';
pacData[2] = '0';
pacData[3] = '$';
quint16 qNum = 150;
quint8 qNumFotosMSB = (qNum >> 8);
qNumMSB += 48;
quint8 qNumFotosLSB = qNum;
qNumLSB += 48;
pacData[4] = (char)qNumMSB;
pacData[5] = (char)qNumLSB;
qint64 qNumBytes = m_qSocket.write(pacData,qLong);
To copy to clipboard, switch view to plain text mode
When I recive the data,
qNumImatgesLSB = qTextos.at(1).at(1).toAscii();
qNumImatgesLSB = qTextos.at(1).at(1).toAscii();
To copy to clipboard, switch view to plain text mode
"qNumImatgesLSB" is -58 instead of 150.
What I'm doing wrong?
Thanks,
Bookmarks