fixing gui
[mnenc] / password.cpp
index 5ec2cd6..5820762 100644 (file)
@@ -33,7 +33,8 @@ void password::to_string() {
 bool password::to_file(std::string filename) {
        bool worked = false;
        std::ofstream keyfile;
-       if(keyfile.open(filename.c_str())) {
+       keyfile.open(filename.c_str());
+       if(keyfile.is_open()) {
                keyfile << encryptedpw;
                keyfile.close();
                worked = true;
@@ -54,7 +55,7 @@ bool password::from_file(std::string filename) {
                keyfile.close();
                worked = true;
        }
-       key = k;
+       encryptedpw = k;
        return worked;
 }