I have the following C++ code as part of a larger program:
/* Open the output streams */
std::ofstream outputFile;
outputFile.open(outputName);
std::ofstream outputFile1;
outputFile1.open(outputName1);
std::ofstream outputFile2;
outputFile2.open(outputName2);
std::cout << outputFile.is_open() << " " << outputFile1.is_open() << " " << outputFile2.is_open() << std::endl;
if (inputFile.is_open() && outputFile.is_open() && outputFile1.is_open() &&
outputFile2.is_open())
...
It's supposed to open several output file streams which will then - if they are all open - do a series of operations which writes to each one. However the program terminates early because the streams are never open:
0 0 0
Filestream or output streams could not open, ending program!
The variables outputName are std::strings, which I thought was allowed in C++11 (I have the -std flag enabled for C++11 in my OpenBlocks compiler options).
I'm not sure why the streams won't open.
Thanks.