fork download
  1. #include<iostream>
  2. #include<fstream>
  3. using namespace std;
  4. int main(){
  5. ofstream MyWriteFile("filename.txt");
  6. MyWriteFile<<"files can be tricky,but it is fum enough!";
  7. MyWriteFile.close();
  8. string myText;
  9. ifstream MyReadFile("filename,txt");
  10. while(getline(MyReadFile,myText)){
  11. cout<<myText;
  12. }
  13. MyReadFile.close();
  14. }
  15.  
Success #stdin #stdout 0s 5296KB
stdin
Standard input is empty
stdout
Standard output is empty