Quote Originally Posted by Phyxashun View Post
Check your function prototype, make sure you use pass by reference there, also in your function there is no need to declare fptr as an ifstream object; you already did that in your main().

Code:
void getfile(ifstream &fptr)
{

    char *filename;
    cout << "Please provide filename for input file: ";
    cin >> filename;

    fptr.open(filename, ios::in);
}
EDIT:

Also, if I remember correctly ifstream requires the file name to be a standard c string.
NO!
This is undefined behavior!
Using pointers without allocating them
You should use std::string and call the c_str() member function to get the C-style string that the constructor expects.

(Note the position of the & )
Code:
void getfile(ifstream& fptr)
{

    std::string filename;
    cout << "Please provide filename for input file: ";
    cin >> filename;

    fptr.open(filename.c_str(), ios::in);
}
And remember that to use a variable, you simply type its name. Never type its type.
Thus, this is wrong:
istream fptr.open(filename.c_str(), ios::in);
And this is right:
fptr.open(filename.c_str(), ios::in);

Also realize that cin >> stops reading when encountering a space!
To remedy that, use std::getline:
Code:
void getfile(ifstream& fptr)
{

    std::string filename;
    cout << "Please provide filename for input file: ";
    std::getline(std::cin, filename);

    fptr.open(filename.c_str(), ios::in);
}
Oh and while we're at it: Don't remove parameter names