Hey guys, Im writing a login type program that requires a certain drive to have a certain file on it in order to allow you to enter a username and password. The drive part is done but the password part isn't working. I wrote one program to setup the username and password, XOR them together and save it ina file.
Code:
#include <iostream>
#include <fstream>

using namespace std;

int main()
{
     char username[20];
     char password[20];
     cout<<"Set Username: ";
     cin.getline(username, 20);
     cout<<"Set Password: ";
     cin.getline(password, 20);
     char encrypted[20];
     for(int i=0; i<20; i++)
     {
           encrypted[i]=username[i]^password[i];
     }
     ofstream fout("L:/Login/Log-On.txt");
     fout<<encrypted;
     fout.close();
     return 0;
}
Then in the Lgoin pro gram it asks you for you username and password, then XOR's them together the EXACT same way it does in the setup program. Then it STRCMP()'s them together to check. Problem is it never works. I had the program cout<< the different XOR's out (the one from the file and the one from the login program) so i could compare them. They're different, dunno why though. Any ideas? Thanks!