Here is how I do it:
static void Main(string[] args) { string FileName = "c:\\error.txt"; long FilePosition = 137647; FileStream fr = new FileStream(FileName, FileMode.Open); byte[] b = new byte[1024]; string data = string.Empty; fr.Seek(FilePosition, SeekOrigin.Begin); UTF8Encoding encoding = new UTF8Encoding(); while (fr.Read(b, 0, b.Length) > 0) { data += encoding.GetString(b); } fr.Close(); string[] str = data.Split(new string[] { "\r\n" }, StringSplitOptions.None); foreach (string s in str) { Console.WriteLine(s); } Console.ReadKey(); }
String str ends with the following lines:
***** Hand history T5-2847880-18 (TOURNAMENT: S-976-46079) *****
Start: Tue Aug 11 18:14
but there are more lines in the file.
I uploaded error.txt to sendpace: http://www.sendspace.com/file/5vgjtn And here is the full console output: the_same_site / file / k05x3a
Please, help! I am really clueless here. Thanks in advance!
Pavel
source share