Hi,
I have the following code:
quint64 input251 = Q_UINT64_C(2161727824133970762);
quint64 input251 = Q_UINT64_C(2161727824133970762);
QByteArray in251 = QByteArray::fromRawData((char *)&input251, sizeof(input251));
To copy to clipboard, switch view to plain text mode
the first 4 bytes are a time value (to be processed later)
the next 4 are an id value.
in251 holds the value: "J[²
This piece of code:
bool ok;
msgTime = in251.left(4).toUInt(&ok);
if (!ok) printf ("Conversion ERROR!\r\n" );
bool ok;
msgTime = in251.left(4).toUInt(&ok);
if (!ok) printf ("Conversion ERROR!\r\n" );
To copy to clipboard, switch view to plain text mode
always returns "Conversion error" and msgTime, of course, is set to zero.
Why can't .toUint() convert those bytes to an int? ![Confused](images/smilies/confused.png)
Already thankful for any thoughts,
Pedro Doria Meunier
Bookmarks