Question

I am working on a simple password manager in C++, and am wondering how I can keep my passwords updated after I close the program.

If I update the passwords in the program, they'll just revert to what's in the source code after I exit the program, I believe. Is there a way to make the changes persistent, after the program is closed?

Short of writing the password list over and over to an output file when I change passwords, is there another way to do this?

Was it helpful?

Solution 2

The answer depends on the system/platform you're writing for. Basically, you need some sort of persistent storage, it can be local file system or an external storage such as database. Writing to a file looks like a quick and simple solution, however you may want to take care of security. Therefore use some encryption library. If your list of passwords is big enough but you still want to use local storage, consider sqlite.

OTHER TIPS

I would highly suggest to use something already existing and highly qualified. The kind of persistant storage you need is up to your requirements.

For an application that simply needs to store informations about the current context or some sort of credentials, I would suggest the use of a lightweight transactional database such as a SQLite database. A comprehensive and simple API exists for C/C++.

Using a database system such as SQLite or MySQL that follows the ACID principles is much more easy as the database system guarantees Consistency, Atomicity of the transactions, Isolation and Durability. This would make your application storage much more efficient and less prone to common programming errors and you will be advertised if any error occurs during a transaction.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top