-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclave.bak
More file actions
46 lines (37 loc) · 872 Bytes
/
clave.bak
File metadata and controls
46 lines (37 loc) · 872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/* ===================================================================================
Programa: Leer clave ---- by mark TM
//El programa necesita estas bibliotecas
#include <conio.h>
#include <stdio.h>
#include <windows.h>
//Definir ENTER
#define ENTER 13
La funcion : leerClave("Titulo",max,variable);
=================================================================================== */
#include <conio.h>
#include <stdio.h>
#include <windows.h>
//Definir ENTER
#define ENTER 13
void leer_clave(char *titulo, int maxCaracteres, char *clave){
printf("%s: ",titulo);
char c;
int i = 0;
while((c = getch()) != ENTER && i < maxCaracteres-1){
if(c == 8){
if(i > 0){
i--;
printf("\b \b");
}
} else {
printf("*");
clave[i] = c;
i++;
}
}
clave[i] = '\0';
}
void main(){
char clave[9];
leer_clave("Clave",9,clave);
}