It reads gibberish because you failed to validate that the file was opened on line 16, which I can see that it was not. Your compiler should have produced an error message saying the std::stream.open() does not take a std::string object as the first parameter. ifs.open(inputfilename.c_str()); Then check if the file was actually opened. if( !ifs.is_open() )
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
have to see the file. Maybe there is a Ctrl+Z at the end of the first file which makes ifstream think its at end-of-file.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343