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