Thao tác trên file với C++
#include<iostream>
#include<fstream>
using namespace std;
class fileProcess
{
public:
string line;
void output()
{
ofstream fo;
fo.open("D:\\test.txt");
if(fo.is_open())
{
fo<<"Vu Nhu Can\n";
fo<<"Dong Nhu Khoi\n";
fo.close();
}
else
cout<<"File not found....!";
}
void input()
{
ifstream fi;
fi.open("D:\\test.txt");
if(fi.is_open())
{
while(!fi.eof())
{
getline(fi,line);
cout<<line<<endl;
}
}
else
cout<<"File not found!!!!"<<endl;
}
};
int main()
{
fileProcess f;
f.output();
f.input();
return 0;
}
Trương Đình Huy
- Một số khác biệt giữa SQL Server và MySQL
- Benefits of Artificial Intelligence in Construction
- Special Purpose Entity (SPE)- Các Tổ Chức Được Thành Lập Với Mục Đích Đặc Biệt
- Khi AI Không Chỉ "Nói Suông": Bước Sang Kỷ Nguyên Của Những Trợ Lý Biết Tư Duy
- Báo cáo Toàn diện về Hình học Riemannian: Khuôn khổ Toán học Tiên tiến trong Giải mã Tín hiệu Sóng não

