I've created a "User Class" for a program I'm writing which stores the username, password, etc.. for users of the program. When users log back into the program, I need for the program to recall previously created Users. Thus, I have to write the user data in a text file.
I'm not sure how to go about doing this/what the most efficient way would be..
do you want to change the file when you reopen the program if that is requested by the user? do you want it to authenticate with the pre-existing password?
The file should be able to be modified, because attributes of the User (like their Name, Age, etc..) should be able to be changed.
Yes, it should be authenticated using the pre-existing password.
Well, what I plan on doing is that each username will be "unique." I plan on storing the usernames in a text file. When a new user is created, it will check to see if that username already exists (searching the text file). Creation of the User Object will then proceed. Each user object will be written to a file. Once a User is created, they can then "login" by entering their Username and Password.
I know how to write simple strings to text files, but not full records like this.
i would make the authentication class with a constructor that uploads all the pre-existing info into a vector. in this class there would be an authentication function comparing strings. an add element function. a change element function.