The whole story is that i wrote some REXX and then just for my learning I try to rewrite it in C++.
In REXX I have line level comparison of two (sorted) files and report all difference with related line number.
What I wanted to do in C++ is to at least preform line level comparison and at first difference to report it and compare next pair.
As I thought load module will be faster then interpreted program, but it wasn't.
string f_res = "OK ";
ifstream fprep;
fprep.open(prep_fname.c_str(), ios_base::in);
if(!fprep.is_open())
throw E(prep_fname += " file cannot be open", 8);
ifstream fexec;
fexec.open(exec_fname.c_str(), ios_base::in);
if(!fexec.is_open())
throw E(exec_fname += " file cannot be open", 8);
string pline;
string eline;
while(!fprep.eof())
{
if(fexec.eof())
{
f_res = "NOK";
cout << "WORK CMPR " << tstid
<< " Different work files sizes.\n";
break;
}
getline(fprep, pline);
getline(fexec, eline);
if(pline != eline)
{
f_res = "NOK";
cout << "WORK CMPR " << tstid
<< " Difference between lines of work files.\n";
break;
}
}
fprep.close();
fexec.close();
return f_res;