Autor Beitrag
davidgippner
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: So 08.01.06 16:48 
Hallo an alle!

Habe folgendes Problem: dieses Programm überwacht die Druckaufträge, schreibt bei einem, der abgeschlossen wurde, User, Seiten und Kosten in eine Datei und soll es dann wieder auslesen. Wenn ich aber den Bericht öffnen will, gibt es die Fehlermeldung E/A Fehler 104, und zwar bevor eine der Messages angezeigt wird. Woran liegt das? Habe schätzungsweise ein meterdickes Brett vor meinem Kopf, ich komm net drauf:

ausblenden volle Höhe Programm zum Auslesen der Logfile
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
procedure TForm1.ffnen1Click(Sender: TObject);
var F: textfile;
    item: TListItem;
    i,j: integer;
    user,pages,cost: array[0..1000] of string;
begin
 Assignfile(F,'C:\report.pcc');
 if not fileexists('C:\report.pcc') then Showmessage('Datei nicht gefunden!')
 else begin
        i:=1;

        while not eof(F) do begin
                            readln(F,user[i]);
                            ShowMessage(user[i]);
                            if eof(F) then break;
                            readln(F,pages[i]);
                            showmessage(pages[i]);
                            if eof(F) then break;
                            readln(F,cost[i]);
                            showmessage(cost[i]);
                            if eof(F) then break;
                            inc(i);
                            end;
        Closefile(F);
 end;
 ReportView.Items.BeginUpdate;
   for j:=1 to i do begin
   item.Caption:=InttoStr(j);
   item.SubItems.Add(user[j]);
   item.subitems.add(pages[j]);
   item.subitems.Add(cost[j]);
   end;
 ReportView.Items.EndUpdate;
end;
0xCC
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 150



BeitragVerfasst: So 08.01.06 17:00 
nach assignfile brauchts noch ein reset oder rewrite, um die datei zum lesen oder schreiben zu öffnen.
Masterhawk
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 92

Win 2000,Win XP
D6 Pers
BeitragVerfasst: So 08.01.06 17:01 
1. Probier mal das AssignFile hinter FileExists zu packen
2. Setz hinter das Assign: Reset(F);
3. Hast du vllt. ein CloseFile in der WriteProzedur vergessen...
davidgippner Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Mo 09.01.06 17:28 
Problem gelöst. Hatte in der Verbohrtheit vergessen Reset(F); anzugeben. Danke für alle Mithilfe!