Save data

Can any C++ or C program save input data?
1
2
#include <fstream> //ofstream
#include <stdio.h> // FILE * 
Can you help me how i use it
1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>
#include <fstream>
int main()
{
  std::ofstream fout("output.txt");
  std::string str;
  while(true)
  {
    std::getline(std::cin, str);
    fout << str << std::endl;
  }
}
Topic archived. No new replies allowed.