正在将.txt - file
读入单个字符串。前14个元素应该是数组中的前14个元素。代码如下:
// The file "read.txt" is being read
string[] lines = File.ReadAllLines("read.txt");
// In this section each line is being read.
foreach (string s in lines)
{
// This line ables the program to differ between variables and numbers.
string[] arr = s.Split(' ');
for (int i = 0; i < 14; i++)
{
M_array_0[i] = Convert.ToInt32(arr[i]);
}
}
此特定问题中的错误如下:
类型&System; FormatException&#39;未处理的execption类型发生在mscorlib.dll
作为附加信息,错误&#39; FormatException未处理&#39;陈列:
附加信息:输入字符串的格式不正确。
为什么格式不正确?以及如何修复它?