无法引用 函数 "std::basic_fstream<_Elem,

#include "stdafx.h"
#include "iostream"
#include "fstream"
#include "stdlib.h"
using namespace std;

void ord(fstream f1)
{
if (!f1)
{
cerr << "文件打不开" << endl;
exit(1);
}
}
void ffout()
{
fstream f1("E:\大中华", ios::out | ios::binary | ios::ate|ios::trunc);
ord(f1);
f1 << "我爱我家" << endl;
f1.close();
}
void ffint()
{
char a[100];
fstream f1("E:\大中华", ios::in | ios::binary);
while (!f1.eof())
{
f1.getline(a, 70);
cout << a << endl;
}
f1.close();
}

void main()
{
ffout();
ffint();
}

改为void ord(fstream &f1)就行了,fstream不能复制。

 void ord(fstream *f1)
{
    if (!f1)
    {
        cerr << "文件打不开" << endl;
        exit(1);
    }
}
void ffout()
{
    fstream f1("E:\\大中华", ios::out | ios::binary | ios::ate | ios::trunc);
    ord(&f1);
    f1 << "我爱我家" << endl;
    f1.close();
}
void ffint()
{
    char a[100];
    fstream f1("E:\\大中华", ios::in | ios::binary);
    while (!f1.eof())
    {
        f1.getline(a, 70);
        cout << a << endl;
    }
    f1.close();
}

void main()
{
    ffout();
    ffint();
}