View previous topic :: View next topic |
Author |
Message |
Neox
Joined: 14 Mar 2007 Posts: 4 Location: Fribourg
|
Posted: Wed Mar 14, 2007 10:14 am Post subject: disable echo or hide password in console |
|
|
Hello im new to D language!
Please i need help...
I want to hide with * char, or disable echo in cosole to hide password...
any ideas?
tanks,
roger |
|
Back to top |
|
|
sean
Joined: 24 Jun 2004 Posts: 609 Location: Bay Area, CA
|
Posted: Fri Mar 16, 2007 1:31 am Post subject: |
|
|
There are nonstandard functions to do this. One is getch() IIRC. |
|
Back to top |
|
|
Neox
Joined: 14 Mar 2007 Posts: 4 Location: Fribourg
|
Posted: Tue Mar 27, 2007 8:05 am Post subject: |
|
|
Tanks a lot ! works perfect
Code: |
// function that get and print password
void getAndPrintPwd(){
printf("\nPlease insert password and press enter: \n\n");
while(k!='\r'){ // password end when enter is fetch
k = getch(); // getch -> take char without display it
password ~= k; // ~ operator to append char/string to a string
}
printf("Your password is %.*s\n",password);
}
|
|
|
Back to top |
|
|
|