Posted on 1998-12-11
I have an application that has three passwords. In this application I can change all of them if I want to. The three passwords are stored in an ordinary text file. When the program begins, the passwords are read from the file. When the program closes, the new passwords are saved to the file.
My question is this,
1. How do I read the passwords from the file?
I did use this code but it has problems when the password is set to nothing, ie no password
char password1 ;
fscanf( pf, "%[^\n]\n", password1 );
fscanf( pf, "%[^\n]\n", password2);
fscanf( pf, "%[^\n]\n", password3);
I thought the scan would read until a new line so each password was on a new line.
2. Obviously if someone just opens the text file, then they have the passwords. How do I write to the file and change the characters that are written?