Hello Thesar,
I believe I have finally figured it out.
Starting in main in the second while loop you call "df.getNextValue(value)" which calls "fileReader.readNextValue" in the if statement.When you reach the input "f0.12376" and after I changed the code in "DataFileReader<T>::readNextValue" you return false to "getNextValue()" which returns false back to main.
In the second while loop, when it fails, you continue with:
1 2 3
|
printResults();
os.close();
return 0;
|
Which ends the program before you are finished.
I ended up moving these three lines after the else statement where they belong.
I changed and added this in the "DataFileReader<T>::readNextValue" function of the "DataFileReader.cpp" file:
1 2
|
if (!(iss >> aValue)) // did parsing fail?
throw std::invalid_argument("invalid arguement conversion failed");
|
And added this:
1 2 3 4 5 6
|
catch (const std::invalid_argument& ia)
{
cout <<ia.what() << " - " << readValue << endl;
errorFileStream << readValue << " - " << ia.what() << endl;
return false;
}
|
You can comment out or remove the "cout" if you do not need it.
This helped, but the biggest change is in main. Doing this the "ReadErrors" file now contains 26 entries and the "RangeError" file contains 201 entries.
Now the only problem I have is when the program ends the line
dataFileStream.exceptions(mask);
gives me a run time error of
Microsoft C++ exception: std::ios_base::failure at memory location 0x0019F840.
I expect that the memory location will change, but I am not sure what is causing this error.
Hope that helps,
Andy