Construct a std::ifstream
object with the file name, and then pass a pointer to that object to your loadmatrix
function: std::ifstream
inherits std::istream
, so this typechecks:
std::vector< std::vector<double> > matrix;
std::ifstream f( filename1 );
if ( !f ) {
// XXX Error handling
}
loadmatrix( &f, &matrix );