Does anyone have an example of a username and password function??
THanks.
Does anyone have an example of a username and password function??
THanks.
What is it that you want to do with the username and password? Do you want to search through a database to confirm the entered data or what?
At the beginning of the program i want the user to enter a username. I then would like program to compare the entry with the username that is stored in a file. If that compare == 0 then i want the program to prompt the user to enter a password and the password should also be compared with the password saved in a file.
FAQ > How do I... (Level 1) > Get a line of text from the user/keyboard (C)
FAQ > How do I... (Level 1) > Comparing strings (C)
FAQ > How do I... (Level 2) > How can I get input without having the user hit [Enter]?
FAQ > How do I... (Level 2) > Work with files (C)
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
i wrote myself something so i could see how i would do this...
******************************************
when program is first run....
enter username......save username in file
enter password.....save password in file
display menu
exit program
open program
prompt user for username.....
user enters username.....compare string with that in file if == 0 then
prompt user for password
user enters password...compare string with that in file if == 0 then
display menu
*****************************************
but this way everytime i enter the program its going to save the username and password everytime!?!?
Wrte TWO programs.
Definition: Politics -- Latin, from
poly meaning many and
tics meaning blood sucking parasites
-- Tom Smothers
yes, i'd suggest writing two programs, or one with dual functionality somehow that would give you "admin" privileges to modify the user account settings.
if you wrote two programs, one would be the one that sets up the account, and the other would be the one that uses those accounts and wouldn't work unless you typed in the passwords