Guest User

Untitled

a guest
Apr 23rd, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <iomanip>
  4. #include <sstream>
  5. #include <fstream>
  6. #include <iomanip>
  7. #include <string>
  8. using namespace std;
  9.  
  10. int main()
  11. {
  12. ifstream i_file("Ini.txt"); //open the input file
  13. if (!i_file.is_open())
  14. { //checking whether file is opened
  15. cout << "Input file couldn't be opened. Terminating!" << endl;
  16. system("pause");
  17. }
  18. ofstream o_file("output.txt"); // open the output file
  19. if (!o_file.is_open())
  20. {//check whether opened
  21. cout << "Output file coud not be opened! Terminating!" << endl;
  22. system("pause");
  23. }
  24.  
  25. while (!i_file.eof())
  26. {
  27. for (int i = 1; i <= 8; i++)
  28. {
  29. for (int j = 1; j <= 8; j++)
  30. {
  31. i_file.ignore(INT_MAX,'6'); //My query here is instead of i_file.ignore(INT_MAX,'6') what function shall I use or how can I incorporate variables:i,j, directly as an expression as i<space>j inside a loop)?
  32. string s;
  33. getline(i_file, s);
  34. o_file<< s << setfill(' ');
  35. }
  36. o_file << endl;
  37. }
  38.  
  39. }
  40. i_file.close();
  41. o_file.close();
  42. string getcontent;
  43. ifstream openfile("output.pln"); //displaying content of the parsed file
  44. if (openfile.is_open())
  45. {
  46. while (!openfile.eof())
  47. {
  48. openfile >> getcontent;
  49. cout << getcontent << endl;
  50. }
  51. }
  52. else
  53. { //checking whether file is opened
  54. cout << "File couldn't be opened. Terminating!" << endl;
  55. system("pause");
  56. }
  57. cin.clear();
  58. cin.ignore();
  59. cin.get();
  60. return 0;
  61. }
Add Comment
Please, Sign In to add comment