C读txt到二维数组
时间:2014-12-18 18:52:15
收藏:0
阅读:155
#include<stdio.h>
#include<stdlib.h>
#define maxn 200
void main()
{
FILE *fp;
int s[maxn][maxn];
int i,j;
if((fp=fopen("d:\\temp\\test.txt","r"))==NULL)
{
printf(" can't open");
exit(0);
}
for(i=0;i<maxn;i++)
{
for(j=0;j<maxn;j++)
{
fscanf(fp,"%d",&s[i][j]);
}
}
}转载请注明:小刘
评论(0)