Simplifying file output for scanfs

Please be sure you have first read; Simplifying file outputs for printfs

Currently, you are doing something like this;

     scanf("%d %d %d", &a, &b, &c);
     fprintf(f1, "%d %d %d\n", a, b, c);

This could drive you crazy!

Consider a function;

     void wrf(char *str)
     {
        fprintf(f1, "%s\n", str);
     }

Now in the main (or in a function), rather than scanf, lets get the entire 
line, write it to the file and then sscanf.

     char s1[80];

     ....
     gets(s1); /* get the entire line */
     wrf(s1); /* write the string to the output file */
     sscanf(s1, "%d %d %d", &a, &b, &c); /* now get the variables from the 
                                            string */

*******

Now lets take all of this and see how we might even improve the MatRead 
function.

void MatRead(double x[MATR][MATC])
{
   int i, j, k;
   double temp;
   char s1[80];
   for (i=1; i<MATR; i++)
   {
      sprintf(s1, "Please enter %i elements in row %i all on one line",
                    MATC, i);
      wr(s1);  /* write to terminal and file */

      gets(s1);  /* get the entire line */
      wrf(s1);   /* write it to the file */
      for (j=0; j<MATC; j++)
      {
         sscanf(s1, "%lf", &temp); /* get the elements from the string */
         x[i][j]=temp;
      }
   }