Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- void validate_login(char *l, char *s)
- {
- char login[80];
- char senha[80];
- FILE *fp;
- if(!(fp = fopen("config.txt", "r")))
- {
- fputs("Erro ao abrir arquivo\n", stdout);
- return;
- }
- while(fscanf(fp, "%s%s", login, senha) != EOF)
- {
- if(!strcmp(l, login) && !strcmp(s,senha))
- {
- fputs("\nAcesso liberado\n\n", stdout);
- return;
- } else {
- fputs("\nLogin Incorreto\n\n", stdout);
- }
- }
- }
- int main(void)
- {
- unsigned char login_informado[80] = {0},
- senha_informado[80] = {0};
- fputs("Digite o login: ", stdout);
- scanf("%80s", login_informado);
- fputs("Digite a senha: ", stdout);
- scanf("%80s", senha_informado);
- validate_login(login_informado,senha_informado);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement