I can't manage to save a text file using the "saveFileDialog". I have looked trough many forums and tutorials, but i cant get the right information from neither. So far i have managed to open the Save file dialog and it actualy saves an empty text file with the right name and path,BUT, and this is the part i have trouble with, its EMPTY, and i dont know where you show what information to save on the file and what methods to use!
Here is the code :
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {
saveFileDialog1->ShowDialog();
}
private: System::Void saveFileDialog1_FileOk(System::Object^ sender, System::ComponentModel::CancelEventArgs^ e) {
System::IO::FileStream ^ fs = safe_cast<System::IO::FileStream^>(saveFileDialog1->OpenFile());
}
So can somebody tell me how and what to do?
Thanks in advance!
You use the save file dialog to get a path where to save your file. So basically you would need
saveFileDialog.showDialog();
String filename = saveFileDialog.FileName;
System.IO.StreamWriter file = new System.IO.StreamWriter(filename)
file.writeLine("This is a test");
file.close();
This is just a quick example :D
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.