Is there an easy way to open an fstream using a string? My code is as follows:

bool openArray(std::string *arrayFileName, int *width, int *height,int *myArray)
{
      std::fstream BoardFile;
      BoardFile.open(*arrayFileName);

I obviously cannot use this method since *arrayFileName is not char* but is there another way to do it?

Is there an easy way to open an fstream using a string? My code is as follows:

bool openArray(std::string *arrayFileName, int *width, int *height,int *myArray)
{
      std::fstream BoardFile;
      BoardFile.open(*arrayFileName);

I obviously cannot use this method since *arrayFileName is not char* but is there another way to do it?

Well you can use the c_str () command:
http://www.cplusplus.com/reference/string/string/c_str.html

string filename = "file.txt";
ifstream ins;
ins.open (filename.c_str ());
This question has already been answered. Start a new discussion instead.