In my project, I am trying to create a set of files for output. However, I am unable to open any of the ofstreams whenever I try to approach this. My best approach would use a vector of ofstream pointers shown below, but I am unable to open any of them.
vector<ofstream*> out;
for (int m = 0; m < p; m++)
{
for (int n = 0; n < p; n++)
{
string outname = "TLR" + to_string(n) + "|" + to_string(m) + ".txt";
out.push_back(new ofstream{ outname.c_str() });
}
}
p is typically 5. is_open() reveals that nothing opens (duh). My program compiles and runs with no output. perror says "invalid argument." I am on visual studio 2013 running windows 10. What can I do to make this work? Thanks.
The | character is not allowed in filenames on Windows. The ?,:,<,>, \, /, *, and " characters are also not allowed. All other printable unicode characters are valid.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With