#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
using namespace std;
int main(void)
{
char buff[1024];
ofstream file_oa("a.txt");
if(!file_oa)
{
cout << "a.txt打开失败!" << endl;
return 0;
}
file_oa << "我是a.txt里面的内容123!!!\n";
file_oa.close();
ifstream file_ia("a.txt");
cout << "123" << endl;
while(file_ia.getline(buff,sizeof(buff)))
{
cout << buff << endl;
}
file_ia.close();
ifstream file_ia2("a.txt");
ofstream file_ob("b.txt");
if(!file_ob)
{
cout << "b.txt打开失败!" << endl;
return 0;
}
while(file_ia2.getline(buff,sizeof(buff)))
{
file_ob << buff;
}
file_ia.close();
file_ob.close();
system("cat b.txt");
return 0;
}
#include <fstream>
#include <cstdio>
#include <cstdlib>
using namespace std;
int main(void)
{
char buff[1024];
ofstream file_oa("a.txt");
if(!file_oa)
{
cout << "a.txt打开失败!" << endl;
return 0;
}
file_oa << "我是a.txt里面的内容123!!!\n";
file_oa.close();
ifstream file_ia("a.txt");
cout << "123" << endl;
while(file_ia.getline(buff,sizeof(buff)))
{
cout << buff << endl;
}
file_ia.close();
ifstream file_ia2("a.txt");
ofstream file_ob("b.txt");
if(!file_ob)
{
cout << "b.txt打开失败!" << endl;
return 0;
}
while(file_ia2.getline(buff,sizeof(buff)))
{
file_ob << buff;
}
file_ia.close();
file_ob.close();
system("cat b.txt");
return 0;
}