E
Evyn
Hi all,
Sorry for asking a second question today.
I have the task of reading a text file with a string of length x on
each line. My task is to convert x to a double between 0 and 1. For
example:
File Output
123 0.123
6786 0.6786
I have the following code, which seems to work, but it strikes me
there may be a better way that avoids so many concatanations.
double convert(string s)
{
double x;
string str = "." + s;
x = atof(str.c_str());
return x;
}
Thanks for your time again.
Jim
Sorry for asking a second question today.
I have the task of reading a text file with a string of length x on
each line. My task is to convert x to a double between 0 and 1. For
example:
File Output
123 0.123
6786 0.6786
I have the following code, which seems to work, but it strikes me
there may be a better way that avoids so many concatanations.
double convert(string s)
{
double x;
string str = "." + s;
x = atof(str.c_str());
return x;
}
Thanks for your time again.
Jim