Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- bool FileExists(string fileName) {
- ifstream file(fileName.c_str());
- if (file.is_open()) {
- file.close();
- return true;
- }
- return false;
- }
- int main(int argc, const char * argv[]) {
- string fileName;
- cout << "Podaj nazwe pliku, ktorego istnienie chcesz sprawdzic: ";
- cin >> fileName;
- if (FileExists(fileName))
- cout << "Plik o podanej nazwie istnieje.";
- else
- cout << "Plik o podanej nazwie nie istnieje.";
- cout << endl << endl;
- //system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement