Advertisement
Guest User

Untitled

a guest
Dec 16th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. #include <fstream>
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. const int MAX_CHAR = 40;
  6.  
  7. int main()
  8. {
  9. char file_sentance[MAX_CHAR];
  10. bool missingFile;
  11. ifstream fin;
  12. ofstream fout;
  13.  
  14. fin.open("stuff1");
  15. missingFile = (fin.fail());
  16. if(!missingFile) {
  17. fout.open("stuff2", ios::app);
  18. missingFile = (fout.fail());
  19. if(!missingFile) {
  20. for(int i = 0, n = 1; !fin.eof(); i++, n++) {
  21. fin >> file_sentance[i];
  22. fout << file_sentance[i];
  23. if(n == 5) {
  24. fout << endl;
  25. n = 0;
  26. }
  27.  
  28. }
  29. }
  30. }
  31. else {
  32. cout << "404 File not found\n";
  33. }
  34. fout.close();
  35. fin.close();
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement