Reading from an open file

Posted on 2004-11-12
Last Modified: 2010-04-15
I'd like to read from a text file and parse through it in real time. i.e. I have a log file that remains open and is being written to. I want a log file watcher that reads the new line of data after it's been written and do something with it.  How would I start this?
Question by:jayrod
    1 Comment
    LVL 8

    Accepted Solution

    Hi jayrod,

    Create logger component with event OnWrite that fired when you write any string into log file. As parameter of event you can transfer string written into logger. In log watcher register some event handler for event OnWrite. In this handler you can do everything you want with new string. That way you do not need directly the file but you will know about newly added entries even before it physically stored on disk (I'm sure you remember about filestream cache that doesn't flush immediately after write).


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now