0
一個全球性的ofstream我需要做的某事像這樣:定義在windows窗體
#include <fstream>
...
ofstream myStream
private: System::Void start_Click(System::Object^ sender, System::EventArgs^ e) {
//open ofstream
}
private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e) {
//write to ofstream
}
這可能嗎?
在此先感謝。
你有什麼試過讓你覺得你不能這樣做?這對我來說似乎很簡單。 '流'不是全球性的;它只是你的類的一個實例變量。 – prprcupofcoffee
我試圖按照上面的代碼所示聲明ofstream。但這是不允許的。我目前轉向Streamwriter,但我更喜歡使用ofstream。 –
聲明是什麼樣的?錯誤是什麼? – prprcupofcoffee