Thema: Delphi Problem bei textfile

Einzelnen Beitrag anzeigen

devilone

Registriert seit: 27. Jun 2004
18 Beiträge
 
#6

Re: Problem bei textfile

  Alt 30. Apr 2006, 02:13
hmm.. das was du gepostet hast klappt super..

aber wie bekomme ich das hin , wenn sich die zahle immer ändert??

das hier habe ich probiert klappt aber nicht..

Delphi-Quellcode:
procedure TForm1.Button8Click(Sender: TObject);
var
sn:integer;
begin
 try
 listbox1.Items.Append('SPAWN='+label1.Caption) ;
 sn:= 0 ;
 assignfile (w,'world.save');
 reset (w);
 assignfile (t,'tests.scp');
 rewrite (t);
repeat
readln(w,line);
if pos('SPAWM='+(label1.Caption)+' ', line) <> 0 then sn:= sn + 1;
until eof(w);
 label5.Caption:= inttostr (sn);
 closefile (w);
 closefile (t);
 finally
 button2.Show;
 button3.Show;
 button4.Show;
 label1.Caption:='';
 button1.Hide;
 end;
end;

ok ist zwar nicht sehr elegant aber funtz jetzt...
Delphi-Quellcode:
procedure TForm1.Button8Click(Sender: TObject);
var
sn:integer;
sie:string;
begin
 try
 listbox1.Items.Append('SPAWN='+label1.Caption) ;
 label7.Caption:= label1.Caption + ' ';
 sie:='SPAWN='+label1.Caption;
 sie:=sie+' ';
 sn:= 0 ;
 assignfile (w,'world.save');
 reset (w);
 assignfile (t,'tests.scp');
 rewrite (t);
repeat
readln(w,line);
if pos(sie, line) <> 0 then sn:= sn + 1;
until eof(w);
 label5.Caption:= inttostr (sn);
 closefile (w);
 closefile (t);
 finally
 button2.Show;
 button3.Show;
 button4.Show;
 label1.Caption:='';
 button1.Hide;
 end;
end;

Danke für eure hilfe..

bis zur nächsten Frage...
  Mit Zitat antworten Zitat