How to compare two files line by line after storing them in vector

  • Thread starter Thread starter Shahzaib17
  • Start date Start date
S

Shahzaib17

Guest

i have two text files named totalfiles.txt and uploaded.txt i am storing both of them in a vector now offcourse when this program will run for a very first time uploaded.txt will be made and it will be empty and first file will be written in it after its successfully uploaded to the server what i want is some kind of method to compare both .txt files so if files that are already uploaded to server don't get uploaded again so is there any method to do that in c++? again at the beginning i am going to store the files in vector and i need to do above operation via vector and not using .txt files directly with fstream

ifstream read2("ScannedFiles.txt");
ofstream read3("Problem.txt", ios::app);
fstream uploaded("Uploaded.txt", ios::app);
vector<string>filen2;
vector<string>upl;
string st3;
string st2;
while (getline(read2, st2))
{
if (st2.size() > 0)
filen2.push_back(st2);
else
break;

}
while (getline(uploaded,st3))
{
if (st3.size() > 0)
upl.push_back(st3);
else
break;
}
<pre> for (vector<string>::iterator t = filen2.begin(); t != filen2.end(); t++)


Continue reading...
 
Back
Top