I open a file and need to print off the names using an array of struct (because I'm going to change the content after, However despite getting the names, I can't store them in the struct. The func[a].nome and the others are blank. Does someone know a way to fix it? Pls don't mind the portuguese.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct Prop
{long int cartaocidadao;
     char nome[60];
     char morada[60];
};
void lerficheiro(){
int Nac,Reg,Dis,Mun;
long int cartaocidadao;
char nome[60],codigopostal[8],morada[60];
int porta,ch, a=0;
char s[100];
FILE *fp;
struct Prop func[2340]; 
 printf("Escreva o nome do ficheiro a abrir (ou ENTER para abrir \"base.txt\") :");
scanf("%s",s);
fp = fopen(s,"r");
if (fp==NULL){
printf("Impossivel ler ficheiro %s\n", s);
exit(2);}
while((ch=fgetc(fp))!=EOF){
fscanf(fp,"%d.%d.%d.%d %ld ",&Nac,&Reg,&Dis,&Mun, &cartaocidadao);
fgets(nome,60,fp);
fgets(morada,60,fp);
fscanf(fp,"%d %s", &porta, codigopostal);
func[a].cartaocidadao = cartaocidadao;
strcpy(func[a].nome, nome);
strcpy(func[a].morada, morada);
a++;
printf("%ld %s \n",cartaocidadao, func[a].nome);
}
}
int main(){
int select=10;
while (select!=0){
Menu1();
printf("selecione:");
scanf("%d", &select);
switch (select){
    case 1: lerficheiro(); break;
    case 2: break;
    case 3: break;
    case 4: break;
    case 5: break;
    case 6: break;
    case 7: break;
    case 8: break;
    case 9: break;
    }
}
}
