Autor Beitrag
Aton
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 125

Windows XP
D7 Enterprise
BeitragVerfasst: Do 13.05.04 17:44 
Hallo Forum,

ich soll ein Programm schreiben, dass 24h am Tag auf dem Server läuft und Daten von einer COM-Schnittstelle sammelt und diese an eine Textdatei anhängt.
Dann gibt es ein zweites Programm auf einem Client, dass diese Textdatei bei Bedarf ausliest und leert.

Meine Frage: Wie kann ich verhindern, dass beide Programme gleichzeitig auf diese Datei zugreifen und etwas durcheinanderkommt?

Gruß Jens.
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: Do 13.05.04 17:45 
Hi!

Du könntest vor dem Schreiben in die Datei überprüfen, ob jene Datei momentan geöffnet ist.
Aton Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 125

Windows XP
D7 Enterprise
BeitragVerfasst: Do 13.05.04 18:10 
Vielleicht kann ich die Datei so öffnen? Ich probiere es mal:

ausblenden Delphi-Quelltext
1:
FileOpen(FileName, fmOpenWrite or fmShareExclusive);					


Gruß Jens.