Thank you for your responses, however I still get errors. In regards to Stewbond's solution, I get the following error:
error: cannot convert 'std::string' to 'double' in initialization
with the code:
1 2 3 4 5 6 7
|
double str2doub(EoGUESS_in);
{
double EoGUESS;
std::stringstream iss (EoGUESS_in);
iss >> EoGUESS;
return EoGUESS;
}
|
where EoGUESS_in is the string "EoGUESS = 1e10"
Using stod, this will compile:
1 2 3
|
std::string::size_type sz; // alias of size_t
EoGUESS = std::stod (EoGUESS_in.substr(sz));
cout << EoGUESS << endl;
|
but, I get the following output:
terminate called after throwing an instance of 'std::out_of_range'
what(): basic_string::substr
Aborted
I should mention that I mostly deal with bash scripts, where this would be extremely simple. I don't do much coding, but a c++ program was handed to me, and it needs file reading desperately. System calls are no good, because I need it to run on both Windows and Linux. Thanks, if you can help me.