INET Framework for OMNeT++/OMNEST
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

double OPP_Global::atod ( const char *  s)

Converts string to double

{
    char *e;
    double d = ::strtod(s,&e);
    if (*e)
        throw cRuntimeError("invalid cast: '%s' cannot be interpreted as a double", s);
    return d;
}
unsigned long OPP_Global::atoul ( const char *  s)

Converts string to unsigned long

Referenced by RoutingTable6::configureInterfaceFromXML().

{
    char *e;
    unsigned long d = ::strtoul(s,&e,10);
    if (*e)
        throw cRuntimeError("invalid cast: '%s' cannot be interpreted as an unsigned long", s);
    return d;
}
std::string OPP_Global::dtostr ( double  d)

Converts a double to string

{
    std::ostringstream os;
    os << d;
    return os.str();
}
std::string OPP_Global::ltostr ( long  i)

Converts an integer to string.

{
    std::ostringstream os;
    os << i;
    return os.str();
}