CppWriter.cpp
上传用户:sz0451
上传日期:2022-07-29
资源大小:256k
文件大小:1k
- // This is the main project file for VC++ application project
- // generated using an Application Wizard.
- #include "stdafx.h"
- #using <mscorlib.dll>
- using namespace System;
- using namespace System::IO;
- // This is the entry point for this application
- #ifdef _UNICODE
- int wmain(void)
- #else
- int main(void)
- #endif
- {
- try
- {
- // Create a FileStream
- FileStream* fs = new FileStream("c:\temp\output.txt", FileMode::Create);
- // Create a StreamWriter
- StreamWriter* sw = new StreamWriter(fs);
- sw->WriteLine(S"First line");
- sw->WriteLine(S"Second line");
- sw->WriteLine(S"Third line");
- sw->Flush();
- sw->Close();
- }
- catch(System::Exception* pe)
- {
- Console::WriteLine(pe->ToString());
- }
- return 0;
- }