Hey folks, I've been working on this project for quite some time today, prolly around like 3 hours and it should be such a simple task!
Basically it reads a wordlist (wordlist.txt) and a scrambled wordlist (encrypted.txt). As for preparation I've only included one string in each file that contains the same thing. Check this out:
Logically this is probably about 80% done, but I can't get anything to work after the .length() issue! Nothing prints so I'm pretty sure nothing happens. Any clue guys?Code:#include <iostream> #include <fstream> #include <string> using namespace std; int main() { unsigned int i =0; unsigned int chardex =0; unsigned int chardexE =0; string decrypt_str; string current_str; string encrypt_str; fstream wordlist("wordlist.txt",ios::in); fstream encrypted("encrypted.txt",ios::in); fstream decrypted("decrypted.txt",ios::out); fstream log("log.txt",ios::out); if(wordlist.is_open() && encrypted.is_open() && decrypted.is_open()) { while(!wordlist.eof()) { getline(wordlist,current_str); getline(encrypted,encrypt_str); log << "This prints whatever i want it to...yet..." if(current_str.length() == encrypt_str.length()) { log << "THIS DOES NOT PRINT! and they are equal fasho." for(chardex=0;chardex<=current_str.length();chardex++) { for(chardexE=0;chardexE<=current_str.length();chardexE++) { if(current_str[chardex] == encrypt_str[chardexE]) { decrypt_str[chardex] == encrypt_str[chardexE]; printf("decrypt[%i] = encrypt[%i]",chardex,chardexE); decrypted << decrypt_str[chardex]; } } } } } encrypted.close(); decrypted.close(); log.close(); } else{ printf("Cannot open the files"); } wordlist.close(); return 0; }
Thanks in advance
EDIT: btw I'm using GCC Compiler in Ubuntu



LinkBack URL
About LinkBacks


