Read and parse comma-delimited file
Read and parse comma-delimited file
i need away to read from the end of the file to the begining instead of begining to end as this code does can anyone help me
using System;
using System.IO;
public class rev {
public static void Main(string[] a) {
string line;
string[] strings = new string[100];
char[] separate = {','};
int i, lineNum;
if (a.Length != 1) {
Console.WriteLine("Usage: prog.exe filename.filetype");
return;
}
StreamReader file = new StreamReader(a[0]);
lineNum = 0;
Console.WriteLine();
while ((line = file.ReadLine()) != null) {
++lineNum;
i = 0;
foreach (string arg in line.Split(separate)) {
i++;
strings[i] = arg.Trim();
Console.WriteLine("Line {0}, token{1}: {2}", lineNum, i, strings[i]);
}
Console.WriteLine();
}
file.Close();
}
}