Delphi - Sharing violation opening text file

Posted by Simes on Stack Overflow See other posts from Stack Overflow or by Simes
Published on 2009-04-26T11:09:58Z Indexed on 2010/05/12 2:54 UTC
Read the original article Hit count: 239

Filed under:
|
|

I'm trying to open a text file for reading in a Delphi 7 app, but am getting I/O error 32 (sharing violation) because another application already has the file open. I've tried setting FileMode to "fmOpenRead or fmShareDenyNone" but now realise this doesn't apply to text files anyway.

Is there a way of reading text files that are open by another application?

var
  f: TextFile;
begin
  FileMode := fmOpenRead or fmShareDenyNone;   // FileMode IS NOT APPLICABLE TO TEXT FILES!!
  AssignFile(f, FileName);
  Reset(f);

© Stack Overflow or respective owner

Related posts about delphi

Related posts about delphi-7