Thread: Passwords

  1. #1
    Unregistered
    Guest

    Exclamation Passwords

    Can someone help please? I want to write a password function using only ANSI/ISO C so that it does not echo what the user types. Like on Linux but is OS independent, so it will work on dos or any other OS. I know you can with CONIO.H but this is not in the standard. If theres a way please help if not can you please say so. Any help would be appreciated.

  2. #2
    Unregistered
    Guest
    There is no OS independent answer to this question.

  3. #3
    Anti-Terrorist
    Join Date
    Aug 2001
    Location
    mming, Game DevelopmentCSR >&<>&2Minimization of boolean functions, PROM,PLA design >&0>&WA, USA guitar, dogsCommercial Aviation >&>>&USAProgramming
    Posts
    742
    Start writing some code than someone can help you out. It's true, conio.h is not in the definition of C, but you can start by using stdio.h functions like scanf and printf.
    I compile code with:
    Visual Studio.NET beta2

  4. #4
    C > C++ duders ggs's Avatar
    Join Date
    Aug 2001
    Posts
    435
    curses/ncurses/pcurses/pdcurses

    search for these libraries.
    .sect signature

  5. #5
    Unregistered
    Guest

    What is all that assembly language mean?

    Im not sure what all that assembly language stuff means?

  6. #6
    Feelin' Silly
    Guest
    I didn't realize at the time but that stuff at the end of your post is at the end of all your posts. I feel stupid

  7. #7
    Anti-Terrorist
    Join Date
    Aug 2001
    Location
    mming, Game DevelopmentCSR >&<>&2Minimization of boolean functions, PROM,PLA design >&0>&WA, USA guitar, dogsCommercial Aviation >&>>&USAProgramming
    Posts
    742
    I posted this code on the C++ board. Thread with the word astericks in it, 2nd page. Question asked by NOOb
    I compile code with:
    Visual Studio.NET beta2

  8. #8
    Anti-Terrorist
    Join Date
    Aug 2001
    Location
    mming, Game DevelopmentCSR >&<>&2Minimization of boolean functions, PROM,PLA design >&0>&WA, USA guitar, dogsCommercial Aviation >&>>&USAProgramming
    Posts
    742
    Code:
    #include<stdio.h>
    #include<conio.h>
    int main()
    {
    	char buffer[12];
    	int i, ch;
    
    	printf("Enter a password (10 alphanumeric sequenc max):\n" );
    	printf("Password: ");
    	
    	/* Read password but no larger than 10 characters */
    	for( i = 0; i < 10 ; i++ )
    	{
    		//get character
    		ch = _getch();
    		//if user enters newline than quit
    		if(ch == '\r' || ch == '\n') break;
    		//if user enters backspace
    		if(ch == '\b')
    		{
    			//if there are no preceeding letters
    			if(i == 0) 
    			{
    				--i;
    				continue;
    			}else //if there are preceeding letters
    			{
    				printf("\b%c\b",' ');
    				i-=2;
    			}
    		}else //no backspace was entered
    		{
    			putc('*',stdout);
    			buffer[i] = (char)ch;
    	
    		}
    	}
    	/* Terminate string with null character: */
    	buffer[i] = '\0';
    	printf( "\n%s", buffer);
    
    	return 0;
    }
    I compile code with:
    Visual Studio.NET beta2

  9. #9
    Unregistered
    Guest

    Thank U :)

    Thanks for that!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. vBulletin vandals and the wisdom of randomly generated passwords
    By abachler in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 12-08-2008, 05:27 PM
  2. Deleting IE saved user names and passwords
    By patrick22 in forum Windows Programming
    Replies: 3
    Last Post: 03-23-2008, 04:38 PM
  3. Database programming and passwords
    By Squintz in forum Windows Programming
    Replies: 6
    Last Post: 11-19-2003, 09:05 PM
  4. Encrypting and checking passwords in bigger programs
    By TerryBogard in forum C Programming
    Replies: 1
    Last Post: 11-17-2002, 07:21 AM
  5. What is the best way to use passwords?
    By GreenCherry in forum C++ Programming
    Replies: 1
    Last Post: 03-22-2002, 11:37 AM