Good Night .... I am doing an automatic login system and validation worked agr. The only problem is that it does not delete the previous character if the user misses the letter, I would like to know how to get the event of the user press the backspace key to delete the wrong character obs - code below
#include <stdlib.h>
#include <stdio.h>
#include <windows.h>
#include <string.h>
char vetor[50];
char user[]= "usuario";
char senha[]= "senha";
int i = 0, c, t=0, j=0, cont=0;
int main(){
void Validacao(char vetor[50],int valida, char desejado[50]);
void ValidacaoSenha(char vetor[50],int valida, char desejado[50]);
//para entrada e reconhecimento da senha versão 1.0
printf("\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t\t\tLogin >> ");
Validacao(vetor,strlen(user),user);
}
void Validacao(char vetor[50],int valida, char desejado[50]){
int i = 0, c, t=0, j=0, cont=0;
do{
c=getch();
fflush(stdin);
vetor[i] = c;
printf("%c", vetor[i]);
i++;
if(vetor[j] == desejado[j]){
cont++;
}
j++;
if(cont==valida){
t=1;
}
} while (t!=1);
}