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
| #include <stdio.h>
#include <string.h>
int main(){
FILE *fi = NULL;
char chnUser[50], chnFi[50], chnRec[50];
char util[50];
long res = 0;
fi = fopen("testc.txt","r");
if (fi == NULL){
printf("Pas de fichier dans le repertoire actif");
// menuPrincipal();
}
else
{
do
{
fgets(chnFi,sizeof(chnFi),fi);
strncpy(chnRec,chnFi,strlen(chnFi)-1);
// printf("%s\n", chnRec);
printf("Utilisateur: ");
scanf("%s", util);
fflush(stdin);
printf("\n\n\nMot de passe: ");
fflush(stdin);
scanf("%s", chnUser);
strncmp(chnRec,chnUser,strlen(chnUser));
if (res != 0){
fi->_file;
if (fseek(fi,0,SEEK_END)) { fclose(fi); break; }
}
else
{
printf("\n\n\t\t\tBienvenue dans mon jeu");
// appel de module
}
}while(fseek(fi,0,SEEK_END));
}
} |
Partager