Originally Posted by
JoshR
Read up on fstream
you need to change the string to a c style string
like this:
Code:
void lfuncWrite(string lsFiletowrite, string lsContentstowrite)
{
ofstream File;
char* fn = lsFiletowrite.c_str();
File.open(fn); //load for output (writing) and delete contents.
File << lsContentstowrite; //write.
File.close(); //close the file when done
cout << "Done.";
}
JoshR, the changes you made are not necessary, I assume/hope you only did them to show what is going on.
Code:
void lfuncWrite(string lsFiletowrite, string lsContentstowrite)
{
ofstream File(lsFiletowrite.c_str()); //load for output (writing) and delete contents.
File << lsContentstowrite; //write.
cout << "Done.";
}
iamthejake2000, The code in red is all you need.