The code I have does not write to a text file even after establishing a text file in the code and using several write methods.
I am using a window GUI maker. The GUI consists of four buttons that are change a label. The problem occurring is that after closing the GUI, the value of the button that was last pressed is supposed to be saved into a text file, however, the code does not save it. Here is an example of on of the buttons.
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
//label3->Text = "Winter";
//vector<String> stringList;
//stringList.push_back("");
fstream stringFile;
sudden = "Winter";
label3->Text = sudden;
stringList.push_back("Winter");
stringFile.open("lastButton.txt", fstream::app);
for (int i = 0; i < stringList.size(); i++) {
stringFile << "Winter. /n";
}
stringFile.close();
}