-
Registered User
FileError function.
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);
}
}
-
void FileFail(ifstream InFile, char* FileName)
-
Registered User
?
I have know idea how to apply that code. It's using pointers which i don't have a clue what they are doing.
Popular pages
Recent additions