C读txt到二维数组

 1 #include<stdio.h>
 2 #include<stdlib.h>
 3 
 4 
 5 #define maxn 200
 6 void main()
 7 {
 8   FILE *fp;
 9   int s[maxn][maxn];
10   int i,j;
11   if((fp=fopen("d:\temp\test.txt","r"))==NULL)
12   {  
13   printf(" can't open");
14   exit(0);
15   }
16 
17 
18   
19   for(i=0;i<maxn;i++)
20   {
21   for(j=0;j<maxn;j++)
22   {
23   fscanf(fp,"%d",&s[i][j]);
24   }
25   }
26     
27 }
原文地址:https://www.cnblogs.com/vpoet/p/4659618.html