ifstream's constructor and open() member function accept strings in modern implementations (this behavior was standardized in C++11).
Earlier, they only accepted pointers to elements of null-terminated arrays of char (aka C strings)
@cubbi: thank you i did not know that
for ur problem: there is something wrong with the file. could it be to big? or the wrong file? as for char*'s:
in c, they dont have classes, and as a result, no std::string class. instead they used char*'s, which was literally a string of chars. so its just the precursor to the string class (or i think basic_string<char>)
The code you posted should work perfectly fine and it should not be skipping the getline statement.
Also the main reason people get Failed to open errors is because they don't have the file in the programs directory so make sure you have it there.
Another suggestion for your function would be this. Since it is a function and you are accepting streams, you don't know if that stream is already open or if that stream is in a error state. Both of these can cause major problems and can be a pain to track down and fix.
So I recommend you do something like this at the very beginning of the function just to be sure.
If any of your two streams have a file already opened it will close them and it also clears any errors state the two streams might have. Always remember to do something like this when using a stream with multiple files cause it will save you from a big headache later on.