#include <fstream>
#include <iostream>
#include <cassert>
using namespace std;
int main()
{
ifstream inFile;
ofstream outFile;
inFile.open("file.txt");
assert(!inFile.fail());
cout << "everythings fine" << endl;
cin.ignore();
cin.get();
return 0;
}
This is my current code, file.txt doesnt exist. The program simply crashes. I was hoping for an error message explaining what exactly when wrong(even though i know that the file doesnt exist.)