Simple C question (i think)
hey there people!
well, I've got here some code for a program I'm doing and was wondering if you could help me.
Code:
function disciplinas=ler_disciplinas(ficheiro)
fid2=fopen(ficheiro,"r");
xx=list();
while !feof(fid2)
a=ler_disciplina(fid2);
xx=append(xx,a);
endwhile
fclose(fid2);
disciplinas=xx;
endfunction
well, the problem here is that to run this program i can read from 3 different files , "analise.txt", "computacao.txt" and "fisica.txt".
What I want is to, for ex., if I run :
ler_disciplinas("analise.txt")
all the read data is added to a list named analise.
If I run:
ler_disciplinas("computacao.txt")
all the read data is added to a list named computacao.
Now the program is always adding the data to the list "disciplinas", always overwriting...
So, can you guys help me?
thanks in advance