You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
422 B
27 lines
422 B
1 year ago
|
// FileAccessChecker
|
||
|
#include <iostream>
|
||
|
#include <fstream>
|
||
|
#include <regex>
|
||
|
using namespace std;
|
||
|
|
||
|
int main() {
|
||
|
|
||
|
string filePath = "C:\\Users\\user\\Desktop\\test.txt";
|
||
|
|
||
|
int a = 5;
|
||
|
|
||
|
if (a<4) {
|
||
|
ifstream file(filePath);
|
||
|
|
||
|
cout << "File opened successfully." << endl;
|
||
|
|
||
|
file.close();
|
||
|
} else {
|
||
|
|
||
|
cerr << "Unable to open file: " << filePath << endl;
|
||
|
|
||
|
}
|
||
|
|
||
|
return 0;
|
||
|
}
|