Hi! I am trying to use ofstream. All of the examples I have seen online construct the stream like this:
insertWhat I would like to do is to create a function that takes a string as an input, something like this:Code:ofstream file_writer("my_file_name.txt").
insertHowever, I get an error because file_name is not the correct type. I did some searching without much luck. I would appreciate some feedback about how to fix this problem. Thank you!Code:int write_stuff_to_a_file(string file_name) { ofstream file_writer(file_name); .... }