essentially what im trying to do is to use one print-to-file function in two different ways. i have a print-to-error-file and a print-to-correct-file after i check some user input and i want to combine them.

i am having some problems when i pass in the parameters. here is what i pass:
1. BOOK *fptr as fptr, the pointer to the struct.
2. int num as goods or bads, a seperate counter to print to each seperate file (1. line one, 2. line two, etc.)
3. char *fil as good_file or bad_file for the file to print to
4. a as a for the 1st number of the multidimensional array to print

plz take a look and give me some ideas, thanks.

DECLARATIONS:
Code:
void printer(BOOK *fptr, int num, char *fil, int a);
FILE *good_file = NULL;
FILE *bad_file = NULL;
int s1 = 0, s2 = 0, s3 = 0; /* String length of read in lines */
CALL TO FUNCTION:
Code:
void automatic(BOOK *fptr)
{
   int goods = 0, bads = 0, a = 0;
   good_file = fopen("address book.txt", "w");
   bad_file = fopen("errors.txt", "w");
   ...
   ...
   if(good)
   {   printer(fptr, goods, good_file, a);   }
   else
   {   printer(fptr, bads, bad_file, a);   }
}
FUNCTION:
Code:
void printer(BOOK *fptr, int num, char *fil, int a)
{
   int l, m, n, o, p, q, r;
   num++;                                 /* Increment correct count for print out */
   fprintf(fil, "%d. ", num);       /* Print line number to file */
   for(l = 0; l < UNIT_MAX_SIZE; l++)       /* For loop to print whole string to file */
   {                                        /* Start for loop */
      fprintf(fil, "%c", fptr->flat_unit[a][l]); /* Print character to file */
   }                                        /* End for loop */
   fprintf(fil, " ");                 /* Print space to file */
   for(m = 0; m < NUMBER_MAX_SIZE; m++)     /* For loop to print whole string to file */
   {                                        /* Start for loop */
      fprintf(fil, "%c", fptr->flat_number[a][m]); /* Print character to file */
   }                                        /* End for loop */
   fprintf(fil, " %c ", fptr->flat_divider[a]); /* Print character to file */
   for(n = 0; n < NUMBER_MAX_SIZE; n++)     /* For loop to print whole string to file */
   {                                        /* Start for loop */
      fprintf(fil, "%c", fptr->number[a][n]); /* Print character to file */
   }                                        /* End for loop */
   fprintf(fil, " ");                 /* Print space to file */
   for(o = 0; o < s1; o++)                  /* For loop to print whole string to file */
   {                                        /* Start for loop */
      fprintf(fil, "%c", fptr->street_name[a][o]); /* Print character to file */
   }                                        /* End for loop */
   fprintf(fil, " ");                 /* Print space to file */
   for(p = 0; p < s2; p++)                  /* For loop to print whole string to file */
   {                                        /* Start for loop */
      fprintf(fil, "%c", fptr->street_type[a][p]); /* Print character to file */
   }                                        /* End for loop */
   fprintf(fil, " ");                 /* Print space to file */
   for(q = 0; q < s3; q++)                  /* For loop to print whole string to file */
   {                                        /* Start for loop */
      fprintf(fil, "%c", fptr->suburb_name[a][q]); /* Print character to file */
   }                                        /* End for loop */
   fprintf(fil, " ");                 /* Print space to file */
   for(r = 0; r < POSTCODE_MAX_SIZE; r++)   /* For loop to print whole string to file */
   {                                        /* Start for loop */
      fprintf(fil, "%c", fptr->postcode[a][r]); /* Print character to file */
   }                                        /* End for loop */
   fprintf(fil, "\n");                /* Print end of line to file */
}
COMPILE ERRORS:
(there are more above this but my ms-dos prompt scrolls through them to fast - but they are pretty much similar because of the same fprintf calls)

assign.c(406) : Error: need explicit cast for function parameter 3 to get
from: struct _iobuf*
to : char *
fprintf(fil, "%d. ", num);
^
assign.c(495) : Error: need explicit cast for function parameter 1 to get
from: char *
to : struct _iobuf*
fprintf(fil, "%c", fptr->flat_unit[a][l]);
^
assign.c(498) : Error: need explicit cast for function parameter 1 to get
from: char *
to : struct _iobuf*
fprintf(fil, " ");
^
assign.c(500) : Error: need explicit cast for function parameter 1 to get
Fatal error: too many errors
--- errorlevel 1


so overall this function is pretty screwed i know. but if someone has any ideas that would be great.