Here's a couple tweeks to your code. Gets rid of duplicates by promoting all strings to upper case, then adding them to a std::set. Also, ignores the first character of a string if it is *
#include <set>
#include <fstream>
#include <string>
#include <cctype>
static void ArxGetVar_doit(void)
{
std::wstring temp;
std::set<std::wstring> strings;
std::wifstream ifs( _T("c:\\StringsU.txt") );
std::wofstream ofs( _T("c:\\StringsUOut.txt") );
while( getline( ifs, temp ) ) {
std::transform(temp.begin(), temp.end(), temp.begin(), std::toupper);
if(temp[0] == L'*')
strings.insert(temp.substr(1));
else
strings.insert(temp);
}
resbuf buf;
for(std::set<std::wstring>::iterator it = strings.begin(); it != strings.end(); it++)
{
if(acedGetVar(it->c_str(),&buf) == RTNORM)
{
ofs << it->c_str() << std::endl;
}
}
ofs.close();
ifs.close();
}
} ;