include
include
include
include
include
using namespace std;
ifstream & open_file(ifstream &in, const string & file)
{
in.close();
in.clear();
in.open(file.c_str());
return in;
}
int main(int argc,char *argv[])
{
string filename;
filename = argv[1];
cout << "正在文本去重:" << filename << endl;
cout << "请稍后...";
set <string> ss;
set <string>::iterator iter;
ifstream infile;
ofstream ofile;
if (!open_file(infile,filename ))
{
cerr << "没有加载文件!" << endl;
return 0;
}
string textline;
while (getline(infile, textline))
if(strstr(textline.c_str()," "))
{
ss.insert(textline);
}
ofile.open(argv[2]);
for (iter = ss.begin();iter != ss.end();iter++)
ofile << *iter << endl;
return 0;
}
如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!
txttool.com 说一段 esp56物联 查询128 IP查询