I don't see a problem in the code immediately. Therefore, I have a suggestion for you. Comment off all of the code that prompts and acquires input and do all of that yourself with pseudo-random values. What I mean is come up with the name of a file by yourself and use that. Open the file as you normally would but write five or ten lines of text into it. Something along the lines of "this is message number X". Then close the file, delay for about a second, open the file for reading, and read and output all of the text you find in the file. This will verify your grasp of the mechanics of handling files. Once you have that perfected then uncomment the code that asks for user-input and try your same code with the strings entered by the user.
The key here is to isolate the issues and work on one thing at a time. In your case, your two issues are acquiring user input and handling the files. I find it much easier to tackle one issue at a time when ever possible and then verify the interaction of the components.
One other thing - see your string user_input and then the getline function call? Do you see what they have in common?
That is a bad thing. If you need a fixed-sized buffer, meaning you can't use a string object, then first define a constant for the maximum size of the string. Then declare your character buffer with a size one larger so you have room for the terminating null character, and then use that constant in the getline call. Here is what that code would like with a maximum size of 255 characters:
const size_t bufferSize = 255;
char user_input[ bufferSize + 1 ] = { 0 };
std::cin.getline( user_input, bufferSize );
This way the input can never exceed the size of the buffer and it will always be null-terminated. Also, if you want to change the size of the buffer you do it only one place. That is the primary goal of this tactic.
I noticed you use a string object to read the file in so you should be able to use one to acquire input from the user also and then the above stuff will be unnecessary.
If you find your program is not working for some reason the best way to find out why is to use the debugger. It is an incredibly important tool and one you should strive to learn. If your development environment does not have a debugger then you should find an alternative that does if at all possible. Without one you're essentially flying blind.