Your example is incomplete - so we have to guess.
f = fopen("summadata.txt","w");
for(int h=1; h<=maxlen; h++) {
fprintf(f, "%d\n", tepek->num);
tepek = tepek->next;
}
fclose(f);
should work.
fprintf
works as follows:
- the first argument is the file handle, that is what you get from fopen.
- the format string, here "%d\n", describes, what you want to print. Here it is a integer ("%d") and then a newline ("\n").
- then comes the arguement(s) to the formatstring. In this case the integer, I guess that is
tepek->num
.