fork download
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4.  
  5. int main()
  6. {
  7. std::ofstream out("file.txt");
  8. if(!out.is_open())
  9. return 0;
  10.  
  11. out << "This is a some string c++" << std::endl;
  12.  
  13. out.close();
  14.  
  15. std::ifstream in("file.txt");
  16.  
  17. std::string str;
  18.  
  19. while(in >> str)
  20. std::cout << str << " ";
  21.  
  22. std::cout << std::endl;
  23.  
  24. in.close();
  25.  
  26. // system("PAUSE");
  27. return 0;
  28. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
Standard output is empty