Thread: FileError function.

  1. #1
    Registered User subdene's Avatar
    Join Date
    Jan 2002
    Posts
    365

    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);
    }
    }

  2. #2
    Unregistered
    Guest
    void FileFail(ifstream InFile, char* FileName)

  3. #3
    Registered User subdene's Avatar
    Join Date
    Jan 2002
    Posts
    365

    Unhappy ?

    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 subscribe to a feed