What are the needed flags to create a new file for input and output using fstream?
I seem to get different results on different computers. On some computers the following code successfully creates a new file. On others, it outputs the error "No such file or directory". Note that the file "test.txt" does not exist - it should be created with the call to the fstream constructor.
using namespace std;
std::fstream file("test.txt", std::ios::in | std::ios::out);
if (file.fail()) perror("");
else cout << "Success!" << endl;