Thread: Encryption problem..

  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    1

    Talking Encryption problem..

    I cannot terminate the encryption if it is less than 12 chars.
    Please help. It reads the enter key which I know is equal to '\n' (maybe).

    Code:
    typedef char strWord[13];
    main()
    {
    char cDump;
    strWord pWord;
    int i;
    printf("Enter Password:  ");
    i=1;
    pWord[0]=getch();printf("*");
    while(pWord[i]!='\n'&&i<12)
    {pWord[i]=getch();i++;printf("*");}
    
    }
    Example Output:

    Enter Password: ******

  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
    getch() isn't a standard function, so who knows what it returns when you press the enter key.

    Maybe put some debug code in to test it?
    Like
    printf( "%d ", pWord[i] );
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Encryption problem!!
    By muran_pling in forum C++ Programming
    Replies: 9
    Last Post: 08-22-2006, 07:55 AM
  2. help needed with edit control & encryption
    By willc0de4food in forum Windows Programming
    Replies: 2
    Last Post: 03-16-2006, 08:21 PM
  3. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM
  4. half ADT (nested struct) problem...
    By CyC|OpS in forum C Programming
    Replies: 1
    Last Post: 10-26-2002, 08:37 AM
  5. binary tree problem - help needed
    By sanju in forum C Programming
    Replies: 4
    Last Post: 10-16-2002, 05:18 AM