Help please, code execution outputs instead of
123456
just
456
Why the file is cleared before writing? Trunc not set
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
ofstream a{ "1.txt",ios_base::ate };
a << "123";
a.close();
ofstream b{ "1.txt",ios_base::ate };
b << "456";
b.close();
ifstream c{ "1.txt" };
string str;
c >> str;
cout << str;
return 0;
}