QString conversation
-
Hi All,
Iam Facing issue in converting my Qstring to Long.
1)Here is my QString str ="12345678901234567890"
while converting this to Long temp = str.toLong();
iam getting the temp value as zero.But for
2)QString str ="1234567890"
while converting this to Long temp = str.toLong();
iam getting the temp value as 1234567890.Why is to so.?
What i need to do to get temp value 12345678901234567890 in the first caseThank you
-
If you write
@
long test = 12345678901234567890;
@you'll see the following warning: integer constant is too large for 'long' type Try with qulonglong
[EDIT: code formatting, Volker]
-
You can pass pointer to a bool variable to toLong() to see if your conversion is successful or not. Did you try "qlonglong QString::toLongLong ( bool * ok = 0, int base = 10 ) const"=> qlonglong is typedef of "long long int " and is mostly 64 bit long.
-
try use function @toLongLong()@ or if you don't use a sign @toULongLong()@
-
toLongLong () is working fine
Thanks a lot