winforms - which library is used for StreamWriter in C++ window forms? -
public ref class form : public system::windows::forms::form { public: form(void) { initializecomponent(); void save(string^ word); } //windows form generated code ... ... ... void save(string^ word) { streamwriter^ outfile = gcnew streamwriter("file.txt"); outfile->writeline(word); outfile->close(); } #pragma endregion private: system::void button00_click(system::object^ sender, system::eventargs^ e) { string^ word = "plow"; save(word); } }; }
streamwriter resides in namespace system::io , implemented in mscorlib.dll. add line
using namespace system::io
to imports of code file , ready go.
Comments
Post a Comment