Untitled
unknown
plain_text
3 years ago
1.2 kB
18
Indexable
void showLogForPlayer(char file[50], char pname[50], int start, int end) {
FILE* fD;
int nInicial = 0;
char horaResto[50];
char nombre[50];
char descripcion[100];
fD = fopen(file, "r");
if(fD == NULL) {
printf("Error opening file");
} else {
//Me robo los primeros minutos
fscanf(fD, "%d", &nInicial);
while(!feof(fD)) {
//me robo el resto de segundos
fgets(horaResto, 50, fD);
horaResto[strlen(horaResto) - 1] = '\0';
//me robo el nombre
fgets(nombre, 50, fD);
nombre[strlen(nombre) - 1] = '\0';
//me robo la descripcion
fgets(descripcion, 100, fD);
descripcion[strlen(descripcion) - 1] = '\0';
//OPEROOOOOOOOOOOOOOOOOO
if(strcmp(nombre, pname) == 0) {
if(nInicial >= start && nInicial <= end) {
printf("[%d%s] %s\n", nInicial, horaResto, descripcion);
}
}
//vuelvo a preguntar por los minutos
fscanf(fD, "%d", &nInicial);
}
fclose(fD);
}
}Editor is loading...