Password Masking Of A C Program.

This is a discussion on Password Masking Of A C Program. within the C Programming forums, part of the General Programming Boards category; Code: #include<stdio.h> #include<conio.h> #include<ctype.h> #include<string.h> main() { int ch; char pword[10]; int i = 0; puts ("Please Enter your User ...

  1. #1
    Registered User
    Join Date
    May 2012
    Location
    India
    Posts
    1

    Password Masking Of A C Program.

    Code:
    #include<stdio.h> 
    #include<conio.h>  
    #include<ctype.h>
    #include<string.h>
    main()
    {
    int ch;
      char pword[10];
      int i = 0;
      puts ("Please  Enter your User  password");
      while ((ch = getch()) != EOF && ch != '\n' && ch != '\r' && i < sizeof(pword) - 1)
      {
        if (ch == '\b' && i > 0) 
        {
          printf("\b \b");
          i--;
        }
        else if (isalnum(ch))
        {
          putchar('*');
          pword[i++] = (char)ch;
        }
        }
      if(strcmp(pword,"kamal16")==0)
      {
                               printf("\n                    PASSWORD ACCEPTED");
                               }
                               else
                               {
                                   printf("Invalid Password");
                                   }
                                   getch();
                                   }

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,434
    You'd better read this -> SourceForge.net: Indentation - cpwiki
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Oct 2010
    Posts
    114
    Hi, Gemini16. What do you need help with?

  4. #4

  5. #5

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 01-07-2009, 09:35 AM
  2. char swaps, and echo() password masking
    By spencerhs5 in forum C Programming
    Replies: 2
    Last Post: 07-25-2006, 08:25 PM
  3. password masking
    By xixpsychoxix in forum C Programming
    Replies: 16
    Last Post: 03-09-2006, 02:40 PM
  4. Masking password input
    By cboard_member in forum C++ Programming
    Replies: 9
    Last Post: 07-18-2005, 06:47 PM
  5. Password Program
    By TeenyTig in forum C Programming
    Replies: 5
    Last Post: 02-05-2002, 07:32 PM

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