Jump to content
  • Advertisement
Sign in to follow this  

Event-Based Interface to Log Files

This topic is 4642 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Heres the situation: I have a program P, that creates and writes to a log file while it is running. I want to be able interface with this log in such a way that a new line in the file will feed into my application, which pretty much just sits there and waits for certain events to occur. This sounds like a job for ports on unix, but I am on Windows and I am not that familiar with them, much less how to port file writing on a specific file (i am not aware of P writing to multiple files, but it is a windows application and it doesnt have any console output. So my next thought is to just read from the file via i/o routines. I haven't tested this at all yet (mainly because I don't have access to my development system at the moment) but I am trying to plan ahead a bit. My first guess is that I can pretty much can have an infinite loop of line reading, and at times I will hit EOF but when the P appends a new line it will read that in still. Seems simple enough to me, but the fact that I don't know much about Windows "behind the scenes" and that I have never done anything like this worries me just a bit, so I am expecting the worst. Does anyone have any advice / info on this particular situation?

Share this post


Link to post
Share on other sites
Advertisement
It wasn't clear whether you actually control the interface to P. Is P your own program or someone else's?

I'll assume it's not yours. In that case, one solution under Windows is to use a .NET language like C#, then create a FileSystemWatcher that monitors the file in question, then monitor the OnChanged event.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!