#include<stdio.h> void main() { int i,j,k,n; char d[20,20]; FILE *fp; fp=fopen("d:\\lan\\a.dat", "r"); printf("please input the total kind of steel\n"); scanf("%d",&n); for(k=0;i<n;k++) { i=k/4; j=k%4; fscanf(fp, "%s", d[i,j]); printf("d[%d,%d]=%s\n", i,j,d[i,j]); } fclose(fp); if((fp=fopen("b.dat","w+"))==NULL) { printf("ERROR\n"); } else { for(i=0;i<n;i++) { for(j=0;j<=4;j++) { fprintf(fp,"d[%d,%d]=%s\n",i,j,d[i,j]); } } } fclose(fp); }