Hello, I have created a program that takes a wordlist and outputs it into a .sql database with the md5 of the word in question. I have a problem with being able to terminate the program once the wordlist has ended. As of now I have an if statement that terminates the program with the word 'xit' when it is found in the text file. I need to make it so that the program terminates whenever the variable is the same 2 times in a row. Here is my code:
You need to keep a record of the previous line and compare it to the current line. Something like this. Don't forget to ensure they're different at the start before you start reading from file.
Thanks a bunch. That worked out great! A few small things I may need to iron out, however this solved it. If anyone needs an md5 database hit me up :-)
New code snippet:
1 2 3 4 5 6 7 8 9 10 11 12
while (line!=lineend)
{
line = lineend;
getline (myfile,line);
cout << line << endl;
md5file << "('" << line << "', '" << md5(line) << "')," << endl;
}
if (line==lineend)
{
md5file << "('" << line << "', '" << md5(line) << "');" << endl;
}