You are so right, little mistake from my side :-O
MrWeiland
Posts
-
Read large text files with c# -
Read large text files with c#I dont quite get what you are saying here.. In this case it would be possible to read chunks from whereever you like in file...or did i dont understand what you saying?
FileStream fs=new FileStream(fileName, FileMode.Open, FileAccess.ReadWrite, FileShare.None, 8192 ); //we use the default buffer StringBuilder result=new StringBuilder(8192); byte[] buffer=new byte[8192]; int count=fs.Read(buffer,0,8192); //reading a block from the file, here we could start for example on 2000 instead of pos 0 //(fs.Read(buffer,2000,8192)) ASCIIEncoding encoding=new ASCIIEncoding(); while (count!=0) //stop when Read returns 0 { result.Append(encoding.GetString(buffer)); count=fs.Read(buffer,0,8192); } fs.Seek(0, SeekOrigin.Begin);
-
Read large text files with c#How do you mean you should do then?
-
Read large text files with c#Sent you a mail :)
-
Read large text files with c#I know that i cannot read lets say 80mb big file into a textbox, first i takes too long and second it would take alot of memory. I need to find a approach to read sections from file to textbox and when user scrolls down or push page down it read another section... Is that a good approach to problem or do anyone have another approach to read large textfiles fast... <Im really impressed what Christan Ghisler done with his lister, its really fast.>) Im open for ideas how to solve this problem... -- modified at 12:13 Tuesday 7th March, 2006