[Tutor] Reading text file written by another application

Paul Hartley p.hartley@spitech.com
Tue Apr 29 21:18:12 2003


This is a multi-part message in MIME format.

------=_NextPart_000_00B7_01C30EFB.EBFE5640
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi,

I am sending data between two applications using ascii text files. What =
I would like to know is how can I have one application check that the =
other application has finished writing the text file before starting to =
read it?

Application one starts to write to the file
Application two detects the file has been created - but must not start =
reading it yet
Application one finishes writing to the file
Application two is sure that the file is complete can now read the file, =
then delete it.

The application is Windows so setting file attributes I don't think =
would work.
There can be buffering problems two - I tried getting application one to =
write another file when it had finished - a sort of flag, but the =
buffering meant that the first file had still not been written =
completely to disc!

Kind regards

Paul

------=_NextPart_000_00B7_01C30EFB.EBFE5640
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I am sending data between two =
applications using=20
ascii text files. What I would like to know is how can I have one =
application=20
check that the other application has finished writing the text file =
before=20
starting to read it?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Application one starts to write to the=20
file</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Application two detects the file has =
been created -=20
but must not start reading it yet</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Application one finishes writing to the =

file</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Application two is sure that the file =
is complete=20
can now read the file, then delete it.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The application is Windows so setting =
file=20
attributes I don't think would work.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>There can be buffering problems two - I =
tried=20
getting application one to write another file when it had finished =
-&nbsp;a sort=20
of flag, but the buffering meant that the first file had still not been =
written=20
completely to disc!</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Kind regards</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial =
size=3D2>Paul</FONT></DIV></FONT></DIV></BODY></HTML>

------=_NextPart_000_00B7_01C30EFB.EBFE5640--