I have some input to be read by a input filestream (for example):
-365.269511 -0.356123 -Inf 0.000000
When I use std::ifstream mystream;>
Just read your variables into string and parse them. You can't put string into double variables and expect them to be outputted like a string, because if it worked, strings wouldn't be necessary.
Seomthing like:
string text;
double d;
while(cin >> text)
{
if(text == "Inf") //you could also add it with negative infinity
{
d = std::numeric_limits::infinity();
}
else
{
d = atof(text.c_str());
}
}