#include <iostream>
#include <fstream>
#include <string.h>
#include <stdlib.h>
using namespace std;
void main()
{
fstream read;
cout << "Now opening...\n";
read.open("f1.txt", ios::in | ios::out | ios::app);
if (!read)
{
cout << "ERROR!" << endl;
system("pause");
exit(1);
}
cout << "Opening file succeeded.\nNow getting info...\n";
read.clear();
char m[50];
cout << "Now writing info...\n";
read.write(m, 50);
system("pause");
read.close();
system("pause");
}
为什么会出现图中的情况?!
图片说明