View Full Version : How to convert string into const int ?
babygal
16th July 2010, 07:56
How to convert string into const int ?
dpatel
16th July 2010, 08:01
Try this
const int myInt=myString.toInt();
babygal
16th July 2010, 10:49
Try this
const int myInt=myString.toInt();
It works!
But strangely if I do it the way as shown in code below, I will get error: assignment of read-only variable myInt .
const int myInt = 0;
myInt = myString.toInt();
dpatel
16th July 2010, 10:57
That is an expected behavior, since consts can be assigned value only once. In your case you use your one chance when you assign 0 to it. After that it become read-only.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.