CommandLineParser::getInt() doesn't work with negative integers [message #471791] |
Tue, 17 July 2012 04:56 |
iRANian
Messages: 4308 Registered: April 2011
Karma: 0
|
General (4 Stars) |
|
|
To get it to work, the digit checking loop needs to be changed to:
if (*s < '0' || *s > '9')
{
if (*s == '-') continue;
But if that's done the function will still return '-1' (a valid negative number) when a non-valid number (e.g. text) is passed to the function, therefor you can't do error checking if you want to support '-1' as a value.
Long time and well respected Renegade community member, programmer, modder and tester.
Scripts 4.0 private beta tester since May 2011.
My Renegade server plugins releases
|
|
|
|
|
|