#include <cstdlib>
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char *argv[])
{
string FileLocation;
string Msg;
cout << "請輸入輸出檔路徑:";
getline(cin,FileLocation); //ex: c:\test.txt
ofstream outfile(FileLocation.c_str());
while(true)
{
cout << "請輸入一段文字:";
getline(cin,Msg);
if(Msg == "EXIT")
{
break;
}
outfile << Msg << endl;
Msg = "";
}
system("PAUSE");
return EXIT_SUCCESS;
}