0

I have a 3rd party program which collects information and then sends the data to a non-text file. Normally I would access the data file after writing, however I now wish to access the incoming data so I can perform live calculations on it. To access the live data I can only think of attempting to access the file but do not have any idea how to do so whilst it is being written.

Is there any way in Delphi to read a file while it is being written?

Is there any other way of accessing the live data?

William C
  • 1
  • 1
  • 2
    See [Accessing a single file with multiple threads](http://stackoverflow.com/q/1632470/576719). – LU RD Oct 23 '14 at 21:22
  • Stop transmitting information this way. Pick a conduit designed for sharing. – David Heffernan Oct 23 '14 at 21:23
  • 1
    That depends entirely on how the 3rd-party tool has opened the file. If it was opened in a way that allows sharing while it's being written, then the answer is yes, there is a way in Delphi (actually, in the WinAPI). If it was opened in a way that doesn't allow shared access, then the answer is no. As we have no information about the 3rd-party app, the answer is "Maybe" until you provide more information. Try to open the file in read-only mode with shared access with a `TFileStream` and see if it works, and you'll have the answer. – Ken White Oct 23 '14 at 22:05
  • Thanks Ken, I needed someone to point me in the right direction. – William C Oct 24 '14 at 20:58

0 Answers0