I cannot save a textfile with c++. It goes through the code with no error. My OS is Windows 11 (22H2). C++ and the g++ compiler have both version 12.1.0.
What I've tried:
- checking with debugger, but no error was found
- deactivated Firewall and any other antivirus software
- checked folder rights, and run the .exe as admin
- restarted the computer
My code should be OK, otherwise my previous efforts where unnecessary:
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ofstream MyFile("./test.txt");
MyFile << "Test";
MyFile.close();
return 0;
}