hi.I'm facing a problem with how to make a code which reads the account number and password for each user ..... each user has his own file created when he register... so i need a code which checks the user info in each file .... PLEASE HELP !
how to make a code that loops through each file
this is the part concerning reading from a file
if ( check.is_open())
int count = 1;
if ( count == 7)
if (accountnumber != s)
cout << "Wrong account number !!.." << endl << endl ;
else if ( count == 6)
if ( password != s )
cout << "Wrong Password !!..." << endl << endl ;
count ++ ;
I've never done anything with file system stuff but I imagine if you put all your files into a folder then find a function or library that can populate a list with filenames then you can simply go through the list opening each file.
Going though every file like you propose is insane. Try this.
unix systems keeps the password for all users in one file, however if each user has his own file, the simple way would be that each filename is the account number, within the file is the password.
of course this isn't very secure, but to make it work:
1. have the user enter his account number, and password
2. if the filename is .txt, you'll have to append that to the end of the account number string.
3. open the file, which is a string like "123456789.txt" accountfile.open(accountnumber.c_str());
4. You only need to get one line
1 2 3
5. check to see if the password is what the user typed.
samuel Adams ....firstly thanks for your response ..and thanks for all
secondly i don't understand ... securitykey , line corresponds to which string ?
my strings are >> password //what is saved in the file ,,,
pass //what the user enters when he logs in
unique // the real account number
accountnumber // the account number he enters when he logs in
and the readable file >> is named check