哪个库用于C ++窗口表单中的StreamWriter?

时间:2015-06-01 08:19:13

标签: winforms c++-cli

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);
    }
};
}

1 个答案:

答案 0 :(得分:1)

StreamWriter驻留在命名空间System :: IO中,并在mscorlib.dll中实现。只需添加一行

即可

using namespace System::IO

导入您的代码文件,您就可以开始了。