468,512 Members | 1,361 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,512 developers. It's quick & easy.

Reading end of file stream in C# problem

Hey all,

I'm trying to make my app read the stream of a text file and begin at the end of the file. Then parse all the lines that get added in the text file by a other app (Its a log file from a game) and display it in a multiple editbox or richeditbox.

Ive tryed somthing like this


private FileStream file;
private StreamReader stream;

public void logInstance()
{
file = new FileStream("f:\\everquest\\logs\\eqlog_Machia_xego ny.txt",
FileMode.Open, FileAccess.Read);

stream = new StreamReader(file);
stream.BaseStream.Seek(0, SeekOrigin.End);
}

// This is a timer and schould display all new added lines of text to the richeditbox

public void timer_Tick(object sender, EventArgs e)
{
string logString = stream.ReadLine();

if (logString != null)
{
richTextBox.Text += logString + " \n";
}
}

Anyone has a idee how to do this? the above code will display nothing, if i change the seek to begin it will parse the text file trough.
Sep 10 '06 #1
0 6530

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by nightflyer | last post: by
8 posts views Thread by Phil Slater | last post: by
7 posts views Thread by Shane | last post: by
2 posts views Thread by Mad Scientist Jr | last post: by
8 posts views Thread by T Driver | last post: by
9 posts views Thread by Eric Lilja | last post: by
3 posts views Thread by rsk | last post: by
6 posts views Thread by efrenba | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.