Can anyone help with this? I'm trying to write a function that will output an error if a file couldn't be opened from a supplied name. I've tried passing the name of the input file, but just get errors. Here is the code for the function:
void FileFail(ifstream InFile,char FileName[],int BufferLen)
{
InFile.open(FileName);
if(InFile.fail())
{
cout << "There was an error in opening your file.";
getchar();
exit(EXIT_FAILURE);
}
}



LinkBack URL
About LinkBacks


