When we search something such as an user account in server, we
need to generate strings for checking (I call them seeds). And from
the following code, you can get a sequential string. This is something like
that: if you initialize your seed sting with 'ab', the following will give you
ac,ad,...az,aaa,aab... over and over all of the possible combinations in ch[0x100] except '\0'.
What you need to do
is to choose a char collection, to say, who will join in the permutation;
this is a repeated combination, if you want unrepeated, then
you can Google for it, I had seen it once, but I can't remember it now.
Using the code
So if you need a repeated permutation, you can consider to use the following
Firstly, you choose char collection, and initialize it, here I use [a-z].
After that, you need to initialize the seed. then the code will enter cycle, to
get out the next combination for you. the result string are kept in
szitem. You can use it in your search string. e.g. you can make it to be "rcpt
to:<" + szitem + "@maildomain.com>\r\n", and send out to the smtp server.
If you want ANSI string, you can change it accordingly, here I use UNICODE. I don't think you still need me to do that :-)
anyway, if there is something needed, just drop <a href=mailto:firstname.lastname@example.org>me a line.
#define ENUMCHARCOUNT 26
ch[i] = L'a'+i;
ch[i] = L'\0';
unsigned short seed;
seed[j] = 0xff;
seed = 0;
int kk = 1;
seed[kk] = 0;
seed[kk] = 0;
szitem[j] = ch[seed[j]];
Before you do cool things with the generated string seed, you can use regexps or
other formula to filter it, if the checking process is time consuming (it always be).
Several days before, I used this to get out named items from a script
Last what you should do with this code snippet, is cut out the above code, paste into your app source, and set a breakpoint
at the last line, press F5, when it stop, drag
sztiem into your watch panel.
Then you can see what the cycle does for you.
The last word what I should say is, every one who have been working on a search engine, he must have done the same thing as above,
but I can't find out if anyone posted it here. So I did it myself.
Really appreciate all of your comments! Happy weekend guys!