This function will check to see if a file exist in the computer if it doesnt it will return -1 else 0.
Submitted On | |
By | Josh Nixon |
Level | Beginner |
User Rating | 3.4 (81 globes from 24 users) |
Compatibility | C, C++ (general), Microsoft Visual C++, Borland C++, UNIX C++ |
Category | Algorithms |
World | C / C++ |
Archive File |
#include <fstream.h>
int Check_File(char *FileName)
{
ifstream FileL;
FileL.open(FileName);
if(!FileL)
{
FileL.close();
return -1;
}
else
{
FileL.close();
return 0;
}
}