C++ primer書上例題~~檔案用法
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
int main()
{
ofstream outfile("out");
ifstream infile("in");
if(!outfile)
{
cerr<<"error out";
return -1;
}
if(!infile)
{
cerr<<"error in";
return -2;
}
string word;
while (infile >>word )
outfile <<word<<" ";
return 0;
}
誰看的出來這哪邊有問題???
@@