Smart conversion from a string to different type of numbers



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

.



Relevant Pages

  • Reading (was Some advice for Learnwell)
    ... Probably because it's necessary to be able to play with other instruments and so many standards are in keys such as Bb, Eb, Cmi, etc. - keys hardly ever found in CG repertoire? ... They do this during their first semester, as part of ensemble - they spend one rehearsal per week in a reading class. ... Memorize the notes names across the six strings in positions 5, ... I don't have any scale requirements, beyond the technical regime all undergraduate students go through - all students meet once a week every semester for guided technical practice, regardess of their technical level (even ththose who enter the program with good technique). ...
    (rec.music.classical.guitar)
  • Re: Reading a file into a byte array?
    ... Strings are the wrong data-buffer for this. ... So when using a file for reading the code for starting something ... BufferedInputStream is not necessary. ... int read = 0; ...
    (comp.lang.java.help)
  • Re: My Sight Reading Solution in Phases
    ... memorize all the notes/notation from open strings to the 12th fret, ... complex rhythms. ... base strings and notes on the 3 treble strings in that position. ... Benedict books and the stack of other sight reading books I have. ...
    (rec.music.classical.guitar)
  • Re: My Sight Reading Solution in Phases
    ... complex rhythms. ... base strings and notes on the 3 treble strings in that position. ... Benedict books and the stack of other sight reading books I have. ... notation at every string/fret and position up to the 14th fret. ...
    (rec.music.classical.guitar)
  • Re: My Sight Reading Solution in Phases
    ... complex rhythms. ... base strings and notes on the 3 treble strings in that position. ... Benedict books and the stack of other sight reading books I have. ... notation at every string/fret and position up to the 14th fret. ...
    (rec.music.classical.guitar)