Read dynamic textstream
-
Hello forum, I want to display the input of a logfile in a textbox. The difficulty is that the logfile grows and the content of the textbox should also display the new entries in realtime. I do not want to read the whole content of the logfile and display it in the textbox. What I am looking for is to read the stream till "readline = null" and then try to read every x seconds from that position on. Does anyone know if that is possible? Thanks in advance, MG
-
Hello forum, I want to display the input of a logfile in a textbox. The difficulty is that the logfile grows and the content of the textbox should also display the new entries in realtime. I do not want to read the whole content of the logfile and display it in the textbox. What I am looking for is to read the stream till "readline = null" and then try to read every x seconds from that position on. Does anyone know if that is possible? Thanks in advance, MG
I would recommend the usage of the
FileSystemWatcher
class, so that you only re-read your log file when it has changed instead of every x seonds. To prevent the reading of already retrieved text, store thePosition
property of your stream after every reading and then seek forward to this position when re-reading the log file.
-
Hello forum, I want to display the input of a logfile in a textbox. The difficulty is that the logfile grows and the content of the textbox should also display the new entries in realtime. I do not want to read the whole content of the logfile and display it in the textbox. What I am looking for is to read the stream till "readline = null" and then try to read every x seconds from that position on. Does anyone know if that is possible? Thanks in advance, MG
http://www.codeproject.com/csharp/WinTail.asp[^]
"When the only tool you have is a hammer, a sore thumb you will have."
-
Hello forum, I want to display the input of a logfile in a textbox. The difficulty is that the logfile grows and the content of the textbox should also display the new entries in realtime. I do not want to read the whole content of the logfile and display it in the textbox. What I am looking for is to read the stream till "readline = null" and then try to read every x seconds from that position on. Does anyone know if that is possible? Thanks in advance, MG