Do you want to use std::string references here? And do you want outputfilename to be const?