比如说你的已经打开了一个"my.txt"的文件
ifstream infile("my.txt".ios::in);
if(!infile)
{
cerr<<"文件打开失败"<
}
char ch;
while(!infile.eof())
{
infile >> ch;
cout <
#include
#include
using namespace std;
void main()
{
float x,y,z;
int k;
ifstream indata;
ofstream outdata;
indata.open("in.dat");
if(!indata)
{
cout<<"can not open the file:in.dat"<
}
indata>>x>>y>>z;
indata>>k;
cout<
if(!outdata)
{
cout<<"can not open the file :out.dat"<
}
outdata<
outdata.close();
}