void cabclh(){
FILE *fp;
char *val, aux;
int i=0;
char *result, cabeca[60];
fp=fopen("trabalho.txt","r");
if(fp==NULL){
printf("Erro ao abrir o ficheiro\n");
return ;
}
val=(char*)calloc(aux, sizeof(char));
while(fgetc(fp)=='\n'){
fgets(cabeca,60,fp);
printf("%s\n",cabeca);
}
fclose(fp);
free(fp);
}
void infos(){
FILE *fp;
char info[100];
fp=fopen("trabalho.txt","r");
if(fp==NULL){
printf("Erro ao abrir o ficheiro\n");
}
while(fgetc(fp)=='-'){
fgets(info,100,fp);
printf("%s\n",info);
}
fclose(fp);
}
At cabclh i want that the program recognize that the first line is header..but this code doesn't print nothing
At infos i want that he recognize that every lines that begin with '-' are info...