1string filetostring(){
2 ifstream file("file", ios::binary);
3 string fileStr;
4
5 istreambuf_iterator<char> inputIt(file), emptyInputIt;
6 back_insert_iterator<string> stringInsert(fileStr);
7
8 copy(inputIt, emptyInputIt, stringInsert);
9
10 return fileStr;
11}
1#include <fstream>
2#include <string>
3#include <iostream>
4
5int main()
6{
7 std::string input;
8 std::cin >> input;
9 std::ofstream out("output.txt");
10 out << input;
11 out.close();
12 return 0;
13}