I'm having some difficulty (no big surprise) printing the values in a file into a 20x20 array. At the moment the file is just made up of a whole heap of 1s set out in the format of a square array. Have I done something majorly wrong in this code? Particularly the use of !feof and fgetc.
'map' is the file pointer.
Your help is really appreciatedCode:if((map = fopen("map1.txt", "r")) == NULL){ printf("error opening file."); } while(!feof(map)){ for(x=0; x < 20; x++){ for(y=0; y < 20; y++){ array[x][y] = fgetc(map); y++; } x++; } }