文件的读取:
#include "stdafx.h"
#include<fstream>
#include <iostream>
using namespace std;
int main()
{
ifstream in;
in.open("test.txt");
//ifstream in("test.txt");
if (!in)
{
cerr << "failure" << endl;
return 0;
}
char x;
while (in >> x)
{
cout << x;
}
cout << endl;
in.close();
return 0;
}