cin.getline() is working fine, if you would look at your output, notice it has a newline after your file name. This is because cin.getline() is getting the '\n' into the filename.
However, I would still suggest that you use an std::string instead of a char*. This allows you to use std::getline() rather then fstreams getline().