Is it possible to read a file as lines are written to it but not lose your location in the file?

As in there is a program that will write lines of text to a file until it reaches 2.4MB. I want to read this file as these lines of text are added but not start at the top each time.

Is this possible?

TJ

Who is writing to file? Maybe you don't need to read the file, but the lines that are written by the process.
But if the files closes and then someone else tries to append something else to that file with a new writer then if you don't remember what was written by the first writer then you would have to read the file.

Perhaps if you explain your problem better you would get a better answer, but checking the RandomAccessFile class might be a good place to start.

There is a game called NeverwinterNights that prints all of the data to a log file in a form such as

[CHAT WINDOW TEXT] [Mon Feb 08 08:42:03] [42Server48] ===== Server 314 (1 player) =====

and i am looking to read this data from the file (named nwnlogfile1.txt) as it is written. i have no idea how i would go about capturing the data as it is written by the process.

TJ

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.