FileError function.

This is a discussion on FileError function. within the C++ Programming forums, part of the General Programming Boards category; Can anyone help with this? I'm trying to write a function that will output an error if a file couldn't ...

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

    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
    359

    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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21