pdoria
15th July 2009, 17:34
Hi,
I have the following code:
quint64 input251 = Q_UINT64_C(2161727824133970762);
QByteArray in251 = QByteArray::fromRawData((char *)&input251, sizeof(input251));
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" );
always returns "Conversion error" and msgTime, of course, is set to zero.
Why can't .toUint() convert those bytes to an int? :confused:
Already thankful for any thoughts,
Pedro Doria Meunier
I have the following code:
quint64 input251 = Q_UINT64_C(2161727824133970762);
QByteArray in251 = QByteArray::fromRawData((char *)&input251, sizeof(input251));
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" );
always returns "Conversion error" and msgTime, of course, is set to zero.
Why can't .toUint() convert those bytes to an int? :confused:
Already thankful for any thoughts,
Pedro Doria Meunier