C programing fopen
Posted
by Pedro
on Stack Overflow
See other posts from Stack Overflow
or by Pedro
Published on 2010-04-21T01:22:54Z
Indexed on
2010/04/21
1:33 UTC
Read the original article
Hit count: 221
Filed under:
c
#include <stdio.h>
#include <stdlib.h>
typedef struct aluno{
char cabecalho[60];
char info[100];
int n_alunos;
char dados[100];
char curso[100];
int numero;
char nome[100];
char e_mail[100];
int n_disciplinas;
int nota;
}ALUNO;
void cabclh(ALUNO alunos[],int a){
FILE *fp;
int i;
for(i=0;i<100;i++){
fp=fopen("trabalho.txt","r");
}
if(fp==NULL){
printf("Erro ao abrir o ficheiro\n");
}
while(!feof(fp)){
fgets(alunos[i].cabecalho,100,fp);
printf("%s\n",alunos[i].cabecalho);
}
}
fclose(fp);
}
what is wrong here?
main:
int main(int argc, char *argv[]){
ALUNO alunos[100];
int aluno;
int b;
cabclh(aluno,b);
system("PAUSE");
return 0
© Stack Overflow or respective owner