#include<iostream>
#include<fstream>
using namespace std;
int main()
{
fstream fs;
fs.open("2.txt", ios_base::in|ios_base::out);
char str[] = "hello world";
char rstr[16] = {0};
if(fs.is_open())
{
cout << "open success!" << endl;
}
else
{
cout << "open fail!" << endl;
}
//进行写操作
//fs.write(str, sizeof(str));
//进行读操作
fs.read(rstr, 20);
cout << "content:" <<rstr << endl;
fs.close();
}
09-05
1万+

06-09
2569
