關於讀寫文件,C++中有一個專門的頭文件
首先是讀文件示例,如下:
/*************************************************************************
> File Name: list1301_file.cpp
> Author: suool
> Mail: 1020935219@qq.com
> Created Time: 2014年05月22日 星期四 22時15分11秒
************************************************************************/
#include
#include
#include
#include
using namespace std;
int main()
{
ifstream in ("list1301.txt");
if (not in )
{
perror("list1301.txt");
}
else
{
string x;
while(in >> x)
{
cout << x << endl;
}
in.close();
}
return 0;
}