I'm writing a code that will save the username of a user when a button (in this case button1) gets pressed. I save it to a file called info.txt, and i use fstream in order to save it. Currently I'm running into the issue that, while i can open up the file fine, I can't save the data from
textBox1 because it uses the data type String ^, while fstream doesn't support writing in that type. Here is my relevant code:
private: System::Void textBox1_TextChanged(System::Object^ sender, System::EventArgs^ e)
{
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
std::ofstream settings("settings.txt");
settings >> textBox1->Text >> std::endl
}
Obviously I can't use this because textBox1->Text returns the wrong type. Anybody have any solutions?