I'm trying to open a file to overwrite data on it but I'm getting some errors, here's my code
Code:
ifstream file("asdf.txt");
fstream file2("qwerty.txt", fstream::trunc);
if(!file)
cout << "File not found";
if(!file2)
cout << "File not found";
I was using the mode app, and it worked just fine, but I wanna overwrite on the file so I tried using trunc mode and I keep getting File(2) not found, help?
EDIT: I found out that I can overwrite by not adding a second parameter, but I would still like to know why trunc is not working