Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi ,
as you know when in UNIX you want to type password nothing display in monitor?
how can i implement it in c?
tnx
Posted

1 solution

You just accept keyboard input but don't display it. You would use getch for this, which is in conio.h.
 
Share this answer
 
Comments
[no name] 4-Aug-12 4:14am    
i cant understand what u r trying to say!!
i know about getch
but please give me an example if it is possible
Christian Graus 4-Aug-12 4:18am    
I am at a loss. You're learning C, but you don't understand my answer and can't use google ?

char c,password[10];
int i;
while( (c=getch())!= '\n');{
password[i] = c;
printf("*");
i++;
}
[no name] 4-Aug-12 4:30am    
First i should say i write in Linux,
and in Linux there isn't any conio.h.
and it is better i say i want to use this in a honeypot. when server send a prompt for client and client want to type password nothing display.
Jochen Arndt 4-Aug-12 4:38am    
Christian's code snippet is the answer to your question when changing the function call and the include file for Linux: Use getchar() defined in stdio.h.
Christian Graus 4-Aug-12 4:33am    
Ah, it seems in Linux there;s

#include <unistd.h>
char *getpass(const char *prompt);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900