I am trying to make a login screen that can read the usernames and passwords from a text file. I have already built the registration page which outputs the username and password to a file by executing the following:
try (BufferedWriter out = new BufferedWriter(fstream)) {
try {
out.write(username + " " + password);
out.newLine();
JOptionPane.showMessageDialog(null,"User Account '" + username + "' Created");
} catch (IOException ex) {
Logger.getLogger(ServerMenu.class.getName()).log(Level.SEVERE, null, ex);
}
}
the text file will looking something like this:
user1 password1
user2 password2
I have been reading through a lot of documentation to try and figure this one out however the more reading i do the more confused I get. The reason why I am doing it in this way is so that I can continue reading and writing to .dat files for the information that the system will eventually hold.
If anybody can help me in any way shape of form that would be amazing!
Thanks
C
Quick and easy solution. Each line is commented but if you need any help or if there’s anything you don’t get please let know.