Read from text file
StreamReader sr = null;
string file = @"c:\temp\test.txt";
string line;
try
{
sr = new StreamReader(file);
while ((line = sr.ReadLine()) != null)
{
Console.WriteLine(line);
}
}
finally
{
if (sr!= null) sr.Dispose();
}
string file = @"c:\temp\test.txt";
using (StreamReader sr = File.OpenText(file))
{
string line;
while ((line = sr.ReadLine()) != null)
{
Console.WriteLine(line);
}
}
If you need to read types, like in fscanf, you can use the code above, or write scanf yourself

String[] values = line.Split(' ');
int id = int.Parse(values[0]);
...