![]() |
AW: File compare
was passiert aber wenn mehrere lines nicht gleich sind.. result ist doch immer nur 1 Wert?
|
AW: File compare
Klar, die erste unterschiedliche Zeile. Ansonsten musst Du es halt so umbauen/erweitern, dass eine Liste hinten rauskommt.
|
AW: File compare
hm habe folgende function:
Delphi-Quellcode:
und rufe das auf:
function FilesEqual(const First, Second: TFilename; out DiffLine: integer): Boolean;
var s1, s2: TStringlist; i: integer; begin Result := FileExists(First) and FileExists(Second); if Result then begin s1 := TStringlist.Create; try s1.LoadFromFile(First); s2 := TStringlist.Create; try s2.LoadFromFile(Second); i := 0; while (i < s1.Count) and (i < s2.Count) do begin Result := s1[i] = s2[i]; if not Result then begin DiffLine := i; i := s1.Count; s3.Add(s1[i]); end; inc(i); end; finally s2.Free; end; finally s1.Free; end; end; end;
Delphi-Quellcode:
bekomme aber permanent folgendes:
test_functions.FilesEqual('C:\software.txt','C:\software2.txt',i);
i2 := 0; for i2 := 0 to vlxsysstate_functions.s3.Count -1 do Writeln(s3[i2]); test_functions.s3.Free; EStringListError: Listenindex ³berschreitet das Maximum (166) was ist da falsch? |
AW: File compare
Wo kommt denn das s3 in der Funktion jetzt her?
|
AW: File compare
und in welcher Zeile tritt der Fehler auf?
Gruß K-H und das ist doch nicht Dein Ernst oder?
Delphi-Quellcode:
begin
DiffLine := i; i := s1.Count; s3.Add(s1[i]); end; |
AW: File compare
s3 ist in meiner test_functions unit deklariert
welche zeile kann ich leider nicht sagen da er sich beim debug bei folgendem aufruf:
Delphi-Quellcode:
verabschiedet...
test_functions.FilesEqual('C:\software.txt','C:\software2.txt',i);
Wieso was ist daran so schlimm? LG |
AW: File compare
Ich habe das ungute Gefühl, dass Du nicht genau weißt, was Du da tust.
[edit] i steht auf Anzahl der Listenelemente, anschließend willst Du diesen nicht existenten Eintrag dann an s3 anhängen. Wie soll das funktionieren? [/edit] |
AW: File compare
Zum einen, empfehle ich das Debuggen mit Hilfe von [F7], zum anderen ist
Delphi-Quellcode:
tödlich.
i:=s1.count;
s3.add(s1[i]); Gruß K-H |
AW: File compare
Und übergib s3 als Parameter, das ist ja gruselig so.
|
AW: File compare
Zitat:
Gruß K-H |
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:27 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz