OPP_Global Namespace Reference


Functions

std::string ltostr (long i)
std::string dtostr (double d)
double atod (const char *s)
unsigned long atoul (const char *s)


Function Documentation

std::string OPP_Global::ltostr ( long  i  ) 

Converts an integer to string.

00026 {
00027     std::ostringstream os;
00028     os << i;
00029     return os.str();
00030 }

std::string OPP_Global::dtostr ( double  d  ) 

Converts a double to string

00033 {
00034     std::ostringstream os;
00035     os << d;
00036     return os.str();
00037 }

double OPP_Global::atod ( const char *  s  ) 

Converts string to double

00040 {
00041     char *e;
00042     double d = ::strtod(s,&e);
00043     if (*e)
00044         throw new cException("invalid cast: '%s' cannot be interpreted as a double", s);
00045     return d;
00046 }

unsigned long OPP_Global::atoul ( const char *  s  ) 

Converts string to unsigned long

00049 {
00050     char *e;
00051     unsigned long d = ::strtoul(s,&e,10);
00052     if (*e)
00053         throw new cException("invalid cast: '%s' cannot be interpreted as an unsigned long", s);
00054     return d;
00055 }


Generated on Wed Apr 4 13:20:25 2007 for INET Framework for OMNeT++/OMNEST by  doxygen 1.4.7