Thread: Password Masking Of A C Program.

  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 int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    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.

  3. #3
    Registered User
    Join Date
    Oct 2010
    Posts
    132
    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, 10: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, 03: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, 08:32 PM