C#语言逐行读取txt中的数据,并保存到数组中

有txt按行记录部分数据如:
123
456
789
...
要将数据读取到数组int[] a中
a[0]=123
a[1]=456
a[2]=789
求解答

第1个回答  推荐于2016-05-28
FStream stream=new FStream("test.txt",read);

string str=stream.getline();
int i=0;
while (str!=null)
{
a[i]=atoi(str);
i++;
str=stream.getline();
}本回答被提问者采纳
相似回答