ok, I have a data file. inside the data file is an ascii picture that is 20 rows by 50 columns.

I need to open that file and read it into, another array 22x52 (added one line each for the top, bottom, right and left borders). The side borders of the new array are pipes |, the top and bottom borders are all dashes -, except for the 4 corners which are also pipes.

So what I did is opened the file, filled the entire file with a pattern. then filled in the picture from the file, overwriting the unneeded sections of the pattern. then I attempt to print the file and it comes out all screwy. The alignment is all off, and I can't figure out where it went wrong.

Code:
#include <stdio.h>


#define ROWS 20           /* a 2-d array, 20x50 */
#define COLUMNS 50
#define ARRAY_ROWS 22     /* add two rows and two columns for the border */
#define ARRAY_COLUMNS 52



int main()
{
   int i, j;
   char array[ARRAY_ROWS][ARRAY_COLUMNS];  

   int nRows = ARRAY_ROWS;
   FILE *ifp;

   ifp = fopen("snoopy.dat", "r");

   /* fills the outter rim of the array with a border 
      "|"'s are run down the sides, "-"'s are run along the 
       top and bottom border, except for the four corners, 
      where a | is printed. */
   /* I've tested it, and know this part is working correctly */
   for (i = 0; i < nRows; i++)
   {
        for (j = 0; j < ARRAY_COLUMNS; j++)
        {
	    if (j == 0 || j == ARRAY_COLUMNS - 1)
	    {
	        array [i][j] = '|';
	    }
                   else
	    {
                        array [i][j] = '-';
	    }
        }

    }

	/* fill the inner part of the array with what's in the file.
	   The problem seems to be with this part of the code.*/
    for (i = 1; i < nRows -1; i++)
    {

           for (j = 1; j < ARRAY_COLUMNS - 1; j++)
           {
                fscanf (ifp, "%c", &array[i][j]);   
           }
   
     } 





        /* Print the array.  If there is a 0, replace it with a blank   
             space */
       /* This part also appears to be working correctly. */
    for (i = 0; i < nRows; i++)
    {

          for (j = 0; j < ARRAY_COLUMNS; j++)
          {
               if (array [i][j] == '0')
               {
                    printf (" ");
               }
               else
               {
                    printf ("%c", array [i][j]);
               }
         }

        printf ("\n"); 
    }


return 0;
}