Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <fstream>
- #include <iostream>
- #include <string>
- #include <vector>
- #include <sstream>
- using namespace std;
- int main()
- {
- int num = 0, index = 0, found, number, no = 0, position;
- string row, line, temp;
- vector<int> v;
- ifstream used_frames("E:\\ZDaemon\\wads\\dehsupp_zd110b1\\ZeroDev_dehsupp\\My_frames\\used_frames.txt");
- //ofstream outfile("E:\\ZDaemon\\wads\\dehsupp_zd110b1\\ZeroDev_dehsupp\\My_frames\\test1.txt");
- if (used_frames.is_open())
- {
- cout << "File is found!" << endl << endl;
- while (!used_frames.fail())//(used_frames.getline(line, 16))
- {
- getline(used_frames, row);
- cout << row << endl;
- cout << used_frames.tellg() << endl << endl;
- //cout << used_frames.get() << endl << endl;
- num++;
- }
- cout << "Lines: " << num << endl << endl;
- used_frames.clear();
- used_frames.seekg(0, used_frames.beg);
- string str2("Frame ");
- cout << "\"" << str2 << "\" length: " << str2.length() << "\n" << endl;
- for (int j = 0; j < num; j++)
- {
- getline(used_frames, line); position = used_frames.tellg();
- if(!(line.substr(0, 6) == str2 && stringstream(line.substr(6, line.length()-6)) >> number && number > 966 && number < 5088 && line.length() <= 10))
- {
- //cout << line << endl;
- }
- else
- {
- no = 0;
- for (int k = j; k < num; k++)
- {
- getline(used_frames, temp);
- if (temp.compare(line) == 0) no++;
- }
- if(no > 0) cout << line << " has " << no + 1 << " dublicates" << endl;
- used_frames.clear();
- used_frames.seekg(position, used_frames.beg);
- }
- }
- used_frames.close();
- }
- else cout << "File is NOT found!" << endl << endl;
- return 0;
- }
RAW Paste Data