I have a file that contains
360 52 155 ! Global variables 123 23 55 34 234 ! other variablesI wanted to read this file and take out the integer value. I have coded to read the file, take the line, and convert the string into integer.
My code is here
FileStream filefs = new FileStream("file.txt", FileMode.Open);
StreamReader filesr = new StreamReader(xyzfilefs);
string Data = filesr.ReadLine();
string[] temp = Data.Split(' ');
for (int jjj = 0, iii = 0; jjj < temp.length; jjj++)
{
if (temp[jjj] != "")
{
x[iii] = (int)Double.Parse(temp[jjj],
System.Globalization.NumberStyles.Integer);
iii++;
}
}When I execute the program, it gives me Quote
Format Exception was unhandled


Sign In
Create Account


Back to top









