FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

disable echo or hide password in console

 
Post new topic   Reply to topic     Forum Index -> General
View previous topic :: View next topic  
Author Message
Neox



Joined: 14 Mar 2007
Posts: 4
Location: Fribourg

PostPosted: Wed Mar 14, 2007 10:14 am    Post subject: disable echo or hide password in console Reply with quote

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
View user's profile Send private message
sean



Joined: 24 Jun 2004
Posts: 609
Location: Bay Area, CA

PostPosted: Fri Mar 16, 2007 1:31 am    Post subject: Reply with quote

There are nonstandard functions to do this. One is getch() IIRC.
Back to top
View user's profile Send private message
Neox



Joined: 14 Mar 2007
Posts: 4
Location: Fribourg

PostPosted: Tue Mar 27, 2007 8:05 am    Post subject: Reply with quote

Tanks a lot ! works perfect Surprised

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> General All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group