[Interest] string conversion to longlong error
Calogero Mauceri
mauceri at actgate.com
Wed Sep 3 17:53:06 CEST 2014
Hi all,
I'm doing something really simple, but which is driving me crazy.
I'm reading a string from a file and converting it to a long long
integer, but the conversion fails.
The code I'm running is as simple as this
// this string is read from a file
QString str("18446744073709551615");
bool ok;
qint64 value = str.toLongLong(&ok); // Error
the number should be representable in 64 bit. Am I doing something wrong?
More hints, if I convert the number to unsigned long long integer then
it works
bool ok;
quint64 value = str.toULongLong(&ok); // OK
Similarly initializing the long long from the literal value is failing too
Q_INT64_C(18446744073709551615) ; // Error, returns -1
Q_UINT64_C(18446744073709551615); // OK
Thanks for your help!
Calogero
--
Calogero Mauceri
Software Engineer
Applied Coherent Technology Corporation (ACT)
www.actgate.com
More information about the Interest
mailing list