#include #include struct aluno { long nusp; char nome[50]; double nota1; double nota2; }; FILE *fp = NULL; struct aluno *le_reg(); int main() { } struct aluno *le_reg() { long k; struct aluno *a1; if ( fp == NULL ) { fp = fopen("notas.txt", "r"); if ( fp != NULL ) printf("Arquivo aberto com sucesso\n"); } if ( fp == NULL) { printf("Erro ao ler registro\n"); return NULL; } fscanf(fp, "%ld", &k ); if ( k == 0 ) return NULL; a1 = (struct aluno *) malloc(sizeof(struct aluno)); a1->nusp = k; fgets(a1->nome, 49, fp); fscanf(fp, "%lf", & (a1->nota1) ); fscanf(fp, "%lf", & (a1->nota2) ); return a1; }