-
-
Save parzibyte/410c87169f00168f37fe22fbdc9d18a3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://parzibyte.me/blog | |
#include <iostream> | |
#include <fstream> | |
using namespace std; | |
bool archivo_existe(string nombre) | |
{ | |
ifstream archivo(nombre.c_str()); | |
return archivo.good(); | |
} | |
int main(int argc, char const *argv[]) | |
{ | |
string ubicacion = "existe.cpp"; | |
if (archivo_existe(ubicacion)) | |
{ | |
cout << "El archivo existe\n"; | |
} | |
else | |
{ | |
cout << "El archivo NO existe\n"; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment