Code:
#include <iostream.h>
#include <stdlib.h>
#include <fstream>
#include <string>
int main()
{
std::ifstream tfile("C:/test.dat");
std::ifstream tfile2("C:/test2.dat");
char tdata[15000000];
char tdata2[15000000];
int i = 0;
int x = 0;
while (!tfile.eof() && i < sizeof tdata)
{
tfile.get(tdata[i++]);
}
while (!tfile2.eof() && x < sizeof tdata2)
{
tfile2.get(tdata2[x++]);
}
string kokane(tdata);
string kokane2(tdata2);
for(int i=0; i<=(kokane.length() | kokane2.length()); i++)
{
if(! (kokane.substr(i, 1) == kokane2.substr(i, 1)) )
{
cout << "char " << i << ": " << kokane.substr(i, 1) << " !== " << kokane2.substr(i, 1);
}
}
system("PAUSE");
return 0;
}
This code worked better before, but then I messed with it. Anyway, the code worked perfectly on small files, but the files I want to compare are 700-800k big. I don't know if there are characters in those files which the program can't take or if it is something else.
If anyone knows what might be the problem, or if there's any real program for this, please let me know.