Suppose if I have a dynArr pointer and a file pointer as parameters, and in the DynArr I am storing a TYPE with an integer value and a string description. How would I put the TYPEs in the DynArr into a txt file while tabbing between the string and the integer and creating a new line between each TYPE? This is what I have so far:
void write(DynArr arr, FILE *fp)
{ TYPE temp;
int i;
for(i = 0; i < (arr->size); i++){
temp = arr[[i];
fputc(((&temp)->number, filePtr);
fputc('/t', filePtr);
fputs(((&temp)->descrip), filePtr);
fputc(('/n', filePtr);
}
}
Unfortunately, the integer is not apparent.
I think my main problem is my unfamiliarity with fput.
Thanks in advance.
EDIT: Formatting