Click here to Skip to main content
11,933,905 members (55,491 online)
Rate this:
Please Sign up or sign in to vote.
See more: C Linux Sockets
hi ,
as you know when in UNIX you want to type password nothing display in monitor?
how can i implement it in c?
Posted 3-Aug-12 23:04pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You just accept keyboard input but don't display it. You would use getch for this, which is in conio.h.
Bathooman 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;
Bathooman 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

char *getpass(const char *prompt);
Bathooman 4-Aug-12 4:36am
I love you!!

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.151126.1 | Last Updated 4 Aug 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100