My problem is that in this specific drive, visual studio C++ refuses create.txt files using ofstream
or fstream
the worst part is this is only targeting.txt extension I can create the file with any extension except.txt.
I am able to create.txt file in another drive(able to with both ofstream
and fstream
). The drive I'm unable to create a text document in is a HDD that got split into 2 partitions, and the one I am able to create a text document on is jsut an SSD that's not split. Visual Studio is installed on my C drive which is also an SSD.
Please help, I'm desperate.
This is the code I'm using to test.
#include <iostream>
#include <fstream>
using namespace std;
int main() {
ofstream file("filename.p");
file << "1";
file.close();
}
SOLVED: it is antivirus which blocks file creation of.txt files. So just add the whole directory of your project to the exceptions.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.