La Web del Programador: Comunidad de Programadores
 
    Pregunta:  14797 - OCULTAR CLAVE EN PROGRAMA DE LENGUAJE C
Autor:  CRISTIAN DONOSO
TENGO QUE HACER UN PROGRAMA EN C QUE ME ACEPTE UN A CLAVE DE ACCESO( LO TENGO LISTO),PERO MI PREGUNTA ES ¿COMO PUDO HACER PARA QUE LA CLAVE EN EL MOMENTO DE INGRESARLA ,POR PANTALLA NO APARESCAN LOS NUMERO O CARACTERES SINO QUE ASTERISCOS *******?
ADIOS Y
GRACIAS

  Respuesta:  Zugehy Escalante
/*Elaborado por Zugehy Escalante fecha 29/06/2006*/
/* solo admite contraseñas de 8 caracteres usted la debe adecuar a sus necesidades*/

#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <stdlib.h>
void main()
{
char clave[9];
int cont;
fflush(stdin);
for (cont=0; cont<=8; cont++)
{
if (cont< 8)
{
clave[cont]=getch();
printf("*");
}
else
clave[cont]= NULL;
}
fflush(stdin);
if(strcmp(clave, "00000000")==0)//00000000 es la clave predeterminada
{
system("cls");
printf("usted tiene acceso al sistema");
}
else
printf("usted no tiene acceso");

}

  Respuesta:  iVAN rOJ@S
ESO ES SENCILLO SOLO TIENES Q CAPTURAR CARACTER POR CARACTER DENTRO DE UN FOR CON EL GETCH (); LUEGO MANDAS IMPRIMIR * POR CADA CARACTER Q METAS

  Respuesta:  edx
Pues prueba getpass o mandame un mail y te envio uno que hice =)