Hi. I'm having trouble understanding ios:: fstream..
When i use ios::app, i can open any new file even if it does not exist in my folder and it wont display error from file.fail()
but when i use ios::ate, i can only open file that exist in my folder or else it will display the error from file.fail()
1 2 3 4 5 6
char filename[15];
cout <<"filename: ";
cin >> filename;
file.open(filename, ios::in | ios::out | ios::app);
while (file.fail())
cout <<"Error! File does not exist.";
how can ios::app check if the file exist or not?
I'm a complete beginner at fstream :'(
i tried compiling something like this.. but i only managed to read the file on the first one with ios::in and the second time, it does not write on the file even with ios::out..