Just some suggestions as quzah seems to have gotten you started on the searching part:
Code:
#include "iostream.h"
You've got all the other up-to-date headers so I don't understand what you are doing with this one here. It should be <iostream> and not "iostream.h".
Code:
struct compare: binary_function<string, string, bool> {
bool operator()(const string& a, const string& b)
{
return strncmp(a.c_str()+258 , b.c_str()+258 , 12)<0;
}
};
You should be able to replace the code in red above with a.compare(258,12,b,258,12). You are using string objects so why not use the string's own compare member function instead of needing to do the conversion to char* and then passing to the strncmp function... it's just a thought.
Code:
void DupRemover(const char *filename, const char *nodup)
{
ifstream in(filename);
ofstream out(nodup);
...
}
...
char filename[12];
char nodup[12];
cout<<"Enter your processed file: ";
cin.getline (filename,11);
strncat (filename, ".all", 6);
cout << "Your File Name is " << filename << ".\n";
cout<<"Enter the new file name: ";
cin.getline(nodup,11);
strncat (nodup, ".all",11);
DupRemover(filename,nodup);
Again, you are already including the string header so why not use it? Replacing all the character arrays with string objects would make sense and be safer, i.e.:
Code:
void DupRemover(const string& filename,const string& nodup)
{
ifstream in(filename.c_str());
ofstream out(nodup.c_str());
...
}
...
string filename;
string nodup;
cout<<"Enter your processed file: ";
getline(cin,filename);
filename += ".all";
cout << "Your File Name is " << filename << ".\n";
cout<<"Enter the new file name: ";
getline(cin,nodup);
nodup += ".all";
DupRemover(filename,nodup);
Making all the above changes, removing any references to strncmp and strncat function and any character arrays, means you can delete the #include <cstring> line as it will no longer be needed.
Again, the above are only suggestions. Use them or not.