You can get a c-style string representation of a C++ string object with c_str().


ofstream file_writer(file_name.c_str());