I just want to read a large CSV file and keep the Stream position in the list. After that I need to read the position from the list and set the position of the Streamreader to char and read the line !! But after I read the first line and returned streamposition with
StreamReader r = new StreamReader("test.csv"); r.readLine(); Console.WriteLine(r.BaseStream.Position);
I get "177" which are full characters in the file! (this is just a short sample file) I did not find anything like it here that helped me!
Why?
Full method:
private void readfile(object filename2) { string filename = (string)filename2; StreamReader r = new StreamReader(filename); string _top = r.ReadLine(); top = new Eintrag(_top.Split(';')[0], _top.Split(';')[1], _top.Split(';')[2]); int siteindex = 0, index = 0; string line; sitepos.Add(r.BaseStream.Position);
The file is as follows:
name;age;city Simon;20;Stuttgart Daniel;34;Ostfildern
And so on this is the Program: http://clean-code-advisors.com/ressourcen/application-katas (Katas CSV viewer) I am now free 3
c # stream position streamreader
coolerfarmer
source share