44 unsigned long suplib::str2ul(
const char* txt,
int base )
throw( Exception ) {
47 if ( NULL == txt ||
'\0' == *txt )
48 throw Exception(
"suplib::strol( ) : Empty field" );
51 long result = ::strtoul( txt, &ptr, base );
53 if ( (result == LONG_MAX || result == LONG_MIN) && errno == ERANGE )
54 throw Exception(
"suplib::str2ul( " +
string( txt ) +
55 ", int ) : Possibly under/over flow" );
58 throw Exception(
"suplib::str2ul( " +
string( txt ) +
59 ", int ) : Not a number, problem starting at `" +
60 string( ptr ) +
"'" );
unsigned long str2ul(const char *txt, int base=10)
convert string to long number