[Lazarus] tail on windows

José Mejuto joshyfun at gmail.com
Mon Jul 19 13:44:19 CEST 2010


Hello Lazarus-List,

Monday, July 19, 2010, 9:17:46 AM, you wrote:

>> AFAIK, it's "impossible" for TFileStream using fmCreate flag. fmCreate
>> flag causes a file to be re-created without sharing (at Windows).
HPD> I can not remember any file attribute "shareable" on Windows. At least
HPD> FAT filesystems have no such file attribute.

fmCreate is = -1 so no other flags can be added to the TFileStream
creation.

HPD> It might be another issue, though, that new files become *visible* to
HPD> other processes only after they have been closed at least once. Same

In Windows at least, a file is visible as soon as it has been created.
Assign does not create the file.

HPD> considerations apply to the file size, that is updated (on disk) only
HPD> when a file is closed. I dunno whether it's possible to read added
HPD> content, before the file has been closed.

When reading a file which is being opened by another process too you
get realtime length information about the file size, but directory
enumeration functions only check the information on disk. So to get
real time information about file sizes you must open each file and
check its size.

HPD> That would mean that *all* log
HPD> files have to be closed and reopened frequently (after every write), to
HPD> give other processes a chance to also read the added text. Kind of a
HPD> Flush or Sync procedure would be nice to have, for that purpose...

No need as the file handle is shared between both (or n) processes,
but each one have its own file pointers. File size is shared between
both processes.

I'm talking about windows with NT kernel. Win98 and others I'm not
sure.

-- 
Best regards,
 José





More information about the Lazarus mailing list