From: "Philippe Ranger" <.> Subject: Re: File Locking Date: 08 Jun 1999 00:00:00 GMT Message-ID: <7jiu2a$3ic1@forums.borland.com> References: <375CE39B.C0819A43@mnl-hub.dhl.com> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Organization: PhilippeRanger@RemoveThis.compuserve.com Reply-To: "Philippe Ranger" Newsgroups: borland.public.delphi.objectpascal <> Use this with the mode you want, or'd with fmDenyWrite. See "File open mode" in the Help. If you're using a text file, just replace the first param type with "text". ----------- Uses sysUtils, windows; Function openInMode(var f: file; sFname: string; nMode: integer): boolean; Var fr: TfileRec absolute f; Begin result := false; assignFile(f, sFname); (*$I-*)reset(f); (*$I+*); if (IOresult <> 0) then EXIT; fileClose(fr.handle); fr.handle :=fileOpen(sFname, nMode); result := (fr.handle <> -1); End; -------------- PhR