30 #include <Exception/Exception.h> 49 if ( NULL == txt ||
'\0' == *txt )
50 throw Exception(
"suplib::strol( ) : Empty field" );
53 long result = ::strtol( txt, &ptr, base );
55 if ( (result == LONG_MAX || result == LONG_MIN) && errno == ERANGE )
56 throw Exception(
"suplib::str2l( " +
string( txt ) +
57 ", int ) : Possibly under/over flow" );
60 throw Exception(
"suplib::str2l( " +
string( txt ) +
61 ", int ) : Not a number, problem starting at `" +
62 string( ptr ) +
"'" );
long str2l(const char *txt, int base=10)
convert string to long number