L
Learner177
Guest
this is a very simple piece of code to check whether a file exist or not if it exist then do something if it doesn't then create the file and do something else below is the code
#include<iostream>
#include<fstream>
using namespace std;
int main(){
ofstream f;
if (ifstream(u8R"(C:\Users\file.txt)"s))
{
f.open(u8R"(C:\Users\file.txt)"s, ios::trunc);
}
else
{
f.open(u8R"(C:\Users\file.txt)"s, ios:ut);
}
}
i don't know hoe to check whether a file exist or not in release mode.the above code shows the file exist even when t doesn't in release mode but works 100% fine in debug mode
Continue reading...
#include<iostream>
#include<fstream>
using namespace std;
int main(){
ofstream f;
if (ifstream(u8R"(C:\Users\file.txt)"s))
{
f.open(u8R"(C:\Users\file.txt)"s, ios::trunc);
}
else
{
f.open(u8R"(C:\Users\file.txt)"s, ios:ut);
}
}
i don't know hoe to check whether a file exist or not in release mode.the above code shows the file exist even when t doesn't in release mode but works 100% fine in debug mode
Continue reading...