D
d.avitabile
I have a C++ code that is reading a list of parameters from a file.
PARAMETERS stringParam="stringValue", intParam=4, doubleParam =
3.533, ... END
The values can be strings as well as integers or doubles, and I don't
know what they will be ( I don't know how the parameter list will look
like) . At the moment I have a mechanism that select all the values
and read them into C++ strings, regardless of their type.
What I need is a function that converts smartly my strings into
numbers: for instance, if I fed it with "4", it would return me the
type "integer" and store the value 4 accordingly, whereas if I fed it
with a "3.533" it would return the type "double" and store the value
3.533.
Any idea as to something like that exists already?
Thanks in advance
Daniele
PARAMETERS stringParam="stringValue", intParam=4, doubleParam =
3.533, ... END
The values can be strings as well as integers or doubles, and I don't
know what they will be ( I don't know how the parameter list will look
like) . At the moment I have a mechanism that select all the values
and read them into C++ strings, regardless of their type.
What I need is a function that converts smartly my strings into
numbers: for instance, if I fed it with "4", it would return me the
type "integer" and store the value 4 accordingly, whereas if I fed it
with a "3.533" it would return the type "double" and store the value
3.533.
Any idea as to something like that exists already?
Thanks in advance
Daniele