Username function

This is a discussion on Username function within the C Programming forums, part of the General Programming Boards category; Does anyone have an example of a username and password function?? THanks....

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    66

    Username function

    Does anyone have an example of a username and password function??

    THanks.

  2. #2
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    Posts
    4,429
    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?

  3. #3
    Registered User
    Join Date
    Mar 2004
    Posts
    66
    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.

  4. #4
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    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.*

  5. #5
    Registered User
    Join Date
    Mar 2004
    Posts
    66
    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!?!?

  6. #6
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,161
    Wrte TWO programs.
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

  7. #7
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    University of Waterloo
    Posts
    1,904
    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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 04:06 PM
  2. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 02:01 AM
  3. In over my head
    By Shelnutt2 in forum C Programming
    Replies: 1
    Last Post: 07-08-2008, 07:54 PM
  4. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 02:28 PM
  5. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 07:05 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21