Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <iomanip>
- #include <sstream>
- #include <fstream>
- #include <iomanip>
- #include <string>
- using namespace std;
- int main()
- {
- ifstream i_file("Ini.txt"); //open the input file
- if (!i_file.is_open())
- { //checking whether file is opened
- cout << "Input file couldn't be opened. Terminating!" << endl;
- system("pause");
- }
- ofstream o_file("output.txt"); // open the output file
- if (!o_file.is_open())
- {//check whether opened
- cout << "Output file coud not be opened! Terminating!" << endl;
- system("pause");
- }
- while (!i_file.eof())
- {
- for (int i = 1; i <= 8; i++)
- {
- for (int j = 1; j <= 8; j++)
- {
- 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)?
- string s;
- getline(i_file, s);
- o_file<< s << setfill(' ');
- }
- o_file << endl;
- }
- }
- i_file.close();
- o_file.close();
- string getcontent;
- ifstream openfile("output.pln"); //displaying content of the parsed file
- if (openfile.is_open())
- {
- while (!openfile.eof())
- {
- openfile >> getcontent;
- cout << getcontent << endl;
- }
- }
- else
- { //checking whether file is opened
- cout << "File couldn't be opened. Terminating!" << endl;
- system("pause");
- }
- cin.clear();
- cin.ignore();
- cin.get();
- return 0;
- }
Add Comment
Please, Sign In to add comment