|
|
|
|
![]() ![]() |
Jun 4 2006, 03:13 PM
Post
#1
|
|
|
Member [Level 1] ![]() ![]() ![]() ![]() Group: Members Posts: 53 Joined: 4-June 06 Member No.: 24,718 |
We all know that C doesnt not provide us with any function to enter a password so that whatever we type doesnt get on the screen.
I had this problem and i have found a solution. i have made a funtion CODE #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <string.h> getpassword(char[]); getpassword(char password[100]) { char a; int ab=0; while(1) { fflush(stdin); a=getch(); if (a>47 && a<123) { password[ab]=a; ab++; } else if(a==8) { if(ab>0) ab--; } else if(a==13) { password[ab]='\0'; break; } } } In turbo C++ 3.0 you can for e.g. call the function getpassword(char pass) which returns the string to pass. |
|
|
|
![]() ![]() |
Similar Topics
| Topics | Topics | |
|---|---|---|
|
|
|
Lo-Fi Version | Time is now: 24th July 2008 - 06:34 AM |