Autor Beitrag
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Di 21.12.04 19:38 
Hi :)!

Folgendes Problem. Ich habe zwei Programme, die beide eine Datei verwenden: das eine schreibend, das andere lesend. Ich habe folgenden Code, aber das lesende Programm meldet immer I/O error 32...

Lesendes Programm
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
        //Open and display Log
        Filemode := fmShareDenyNone;
        {$I-}
        AssignFile(f, TempStr);
        Reset(f);
        {$I+}
        TempErr := IOResult;
        if TempErr <> 0 then begin
          WriteLn('  viewlog: I/O error ', TempErr, ': Logfile does not exist');
          continue;
          end;
        {$I-}

... Natürlich wird die Datei am Ende auch wieder geschlossen ;)


AXMD
hansa
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3079
Erhaltene Danke: 9



BeitragVerfasst: Di 21.12.04 20:42 
I/O error 32... Toll, daß überhaupt eine angegeben wird. 8) Aber was bedeuten die 3 Punkte ? Die einzige Vermutung fiel gerade vom Himmel und besagt, daß die Schreiboperation noch geöffnet ist. Eine Fehlernr. 32 ist nämlich unbekannt.

_________________
Gruß
Hansa
AXMD Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Di 21.12.04 20:50 
Im schreibenden Programm wird CloseFile erst beim Beenden des Programms aufgerufen. Ich kann doch nicht jedes Mal, wenn ein Logeintrag ansteht die Datei öffnen, reinschreiben und wieder zumachen, oder?

AXMD
hansa
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3079
Erhaltene Danke: 9



BeitragVerfasst: Di 21.12.04 20:51 
Nix oder. :mrgreen:

_________________
Gruß
Hansa
AXMD Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Di 21.12.04 20:54 
:gruebel: Gibts da keine bessere Lösung?

AXMD
hansa
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3079
Erhaltene Danke: 9



BeitragVerfasst: Di 21.12.04 20:57 
Nein, aber klassischer Fall für Datenbank. :lol:

_________________
Gruß
Hansa
AXMD Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Di 21.12.04 21:09 
Gut, ich schließ jetzt einfach jedes Mal das File und öffne es bei Bedarf fürs Loggen neu. Das Ergebnis (siehe Funktion viewlog)

AXMD
hansa
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3079
Erhaltene Danke: 9



BeitragVerfasst: Di 21.12.04 21:18 
Gut so.

_________________
Gruß
Hansa