Thread: simple username password program

  1. #1
    Registered User
    Join Date
    Aug 2011
    Posts
    3

    Question simple username password program

    I need to write a simple username password program, and I would like the characters to appear on the console as * not the character typed. I would really like some help with this, thank you.

  2. #2
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472
    Okay, you have to show what you have done so far - them's the rules - its not a hire board
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

  3. #3
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    You need to use some kind of library for that, unfortunately. If you are on *nix, I think readline will be able to do it:

    The GNU Readline Library
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  4. #4
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Andr0id View Post
    I need to write a simple username password program, and I would like the characters to appear on the console as * not the character typed. I would really like some help with this, thank you.
    Well... get started, work the problem as far as you can, then if you run into trouble post your code and we'll see what we can do...

  5. #5
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,949
    Quote Originally Posted by Andr0id View Post
    I need to write a simple username password program, and I would like the characters to appear on the console as * not the character typed. I would really like some help with this, thank you.
    It is important to note that there is no standard C way of doing this, however:
    FAQ- How do I get input without the user pressing enter?
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  6. #6
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    Quote Originally Posted by AndrewHunter View Post
    It is important to note that there is no standard C way of doing this...
    Is there a standard way to not show any characters at all during the input ?

  7. #7
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,949
    Quote Originally Posted by manasij7479 View Post
    Is there a standard way to not show any characters at all during the input ?
    If you mean standard, as standard C; the answer is no. Once you actually want to mess directly with any stream you have entered OS specific behaviour because you have to "look behind the curtain" to interact with the OS and/or hardware.
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  8. #8
    Registered User
    Join Date
    Aug 2011
    Posts
    3
    Quote Originally Posted by AndrewHunter View Post
    It is important to note that there is no standard C way of doing this, however:
    FAQ- How do I get input without the user pressing enter?
    Thank you this was exactly what I needed. I didn't post code because i had no idea where to start, all I expected was some pseudo code. This was much better thank you all for the help.

  9. #9
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    >> Is there a ... way to not show any characters at all during the input ?
    To enter password without displaying it

    "get_password" using _getch():
    Problem with inputting password?

    _getch() for *nix:
    while getch question

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Username & Password - Problem
    By Sedition X in forum C Programming
    Replies: 2
    Last Post: 04-08-2011, 06:57 AM
  2. Replies: 2
    Last Post: 01-07-2009, 10:35 AM
  3. Read from file and match the password and username
    By plodos in forum C Programming
    Replies: 3
    Last Post: 01-05-2009, 01:10 PM
  4. username password
    By jamie85 in forum C Programming
    Replies: 14
    Last Post: 03-14-2004, 05:46 PM
  5. creating a simple program to accept a password.
    By boy1015 in forum C++ Programming
    Replies: 11
    Last Post: 02-05-2002, 08:34 PM