convert filename to C string for fstream.open() call