64-битных системах long != int)
{
x = strtoul(str.c_str(), NULL, 10);
{
x = strtoul(str.c_str(), NULL, 10);
+if (errno == ERANGE)
+ return -1;
+
+return 0;
+}
+//---------------------------------------------------------------------------
+int str2x(const std::string & str, long & x)
+{
+x = strtol(str.c_str(), NULL, 10);
+
+if (errno == ERANGE)
+ return -1;
+
+return 0;
+}
+//---------------------------------------------------------------------------
+int str2x(const std::string & str, unsigned long & x)
+{
+x = strtoul(str.c_str(), NULL, 10);
+
if (errno == ERANGE)
return -1;
if (errno == ERANGE)
return -1;
//-----------------------------------------------------------------------------
int str2x(const std::string & str, int & x);
int str2x(const std::string & str, unsigned & x);
//-----------------------------------------------------------------------------
int str2x(const std::string & str, int & x);
int str2x(const std::string & str, unsigned & x);
+int str2x(const std::string & str, long & x);
+int str2x(const std::string & str, unsigned long & x);
int str2x(const std::string & str, long long & x);
int str2x(const std::string & str, unsigned long long & x);
//-----------------------------------------------------------------------------
int str2x(const std::string & str, long long & x);
int str2x(const std::string & str, unsigned long long & x);
//-----------------------------------------------------------------------------