fix ofstream filename c_str compilation issues

release/4.3a0
Duy-Nguyen Ta 2013-08-02 13:33:23 +00:00
parent ef99e1bf1a
commit 95ffb0c4ea
1 changed files with 8 additions and 7 deletions

View File

@ -156,7 +156,7 @@ int main(int argc, char *argv[]) {
if(!inputFile.empty())
{
cout << "Reading input file " << inputFile << endl;
std::ifstream readerStream(inputFile, ios::binary);
std::ifstream readerStream(inputFile.c_str(), ios::binary);
boost::archive::binary_iarchive reader(readerStream);
reader >> initial;
}
@ -338,9 +338,10 @@ void runIncremental()
{
try {
cout << "Writing output file " << outputFile << endl;
std::ofstream writerStream(outputFile, ios::binary);
std::ofstream writerStream(outputFile.c_str(), ios::binary);
boost::archive::binary_oarchive writer(writerStream);
writer << isam2.calculateEstimate();
Values estimates = isam2.calculateEstimate();
writer << estimates;
} catch(std::exception& e) {
cout << e.what() << endl;
exit(1);
@ -420,7 +421,7 @@ void runBatch()
{
try {
cout << "Writing output file " << outputFile << endl;
std::ofstream writerStream(outputFile, ios::binary);
std::ofstream writerStream(outputFile.c_str(), ios::binary);
boost::archive::binary_oarchive writer(writerStream);
writer << optimizer.values();
} catch(std::exception& e) {
@ -437,14 +438,14 @@ void runCompare()
cout << "Reading solution file " << compareFile1 << endl;
{
std::ifstream readerStream(compareFile1, ios::binary);
std::ifstream readerStream(compareFile1.c_str(), ios::binary);
boost::archive::binary_iarchive reader(readerStream);
reader >> soln1;
}
cout << "Reading solution file " << compareFile2 << endl;
{
std::ifstream readerStream(compareFile2, ios::binary);
std::ifstream readerStream(compareFile2.c_str(), ios::binary);
boost::archive::binary_iarchive reader(readerStream);
reader >> soln2;
}
@ -492,7 +493,7 @@ void runPerturb()
// Write results
try {
cout << "Writing output file " << outputFile << endl;
std::ofstream writerStream(outputFile, ios::binary);
std::ofstream writerStream(outputFile.c_str(), ios::binary);
boost::archive::binary_oarchive writer(writerStream);
writer << perturbed;
} catch(std::exception& e) {