As you may have figured out from the title, I'm having problems converting QByteArray to an integer.
QByteArray buffer = server->read(8192);
QByteArray q_size = buffer.mid(0, 2);
int size = q_size.toInt();
However, size
is 0. The buffer
doesn't receive any ASCII character and I believe the toInt()
function won't work if it's not an ASCII character. The int size
should be 37 (0x25), but - as I have said - it's 0.
The q_size
is 0x2500
(or the other endianess order - 0x0025
).
What's the problem here ? I'm pretty sure q_size
hold the data I need.
Please help :)
Thanks !