#include <iostream>
#include <fstream>
using namespace std;
int main()
{
char writefile[] = "hi 优快云";
char readfile[100] = "/0";
int nLen = strlen(writefile);
//打开/创建文件
ofstream ofs("filetest.txt");
//读取文件内容
ifstream ifs("filetest.txt");
ofs.write(writefile, nLen);
//将缓存中的数据清除,并输出直至定目的地
ofs.flush();
ofs.close();
ifs.read(readfile, 100);
cout << "readfile = " << readfile << endl;
return 0;
}