Hi,
nach dem String splitten kommt folgender Fehler:
... raised exception class ... with message 'Access violation at adress ....' .... in line 1
Ich erwarte das durch die Prozedure Split mir der String anhand des Delimiters auf ein String Array verteilt wird. Jedoch ist nur string[0] ansprechbar, bei string[2] ist schon nichts mehr hinterlegt. Dennoch ist Count = 9. Ausserdem wie es scheint ist doch das 'for i := 0 to FilesList.Count do begin' nicht mit 'end' abgeschlossen, wenn ich es setze meckert aber der compiler.
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: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63:
| type Tp_point = record datetime : string; ... end;
ar_tppoints : array[1..2,0..MAX_TP] of Tp_point;
procedure Split (const Delimiter: Char; Input: string; const Strings: TStrings) ; begin Assert(Assigned(Strings)) ; Strings.Clear; Strings.Delimiter := Delimiter; Strings.DelimitedText := Input; end;
procedure TMain.GetUpdateData(); var n, i,x: integer; myfile : TextFile; SR: TSearchRec; IsFound: Boolean; FilesList, strListVal :TStringList; StartDir, strHz, strLine: string; begin FilesList := TStringList.Create; strListVal := TStringList.Create; StartDir := 'c:\system1'; if StartDir[length(StartDir)] <> '\' then StartDir := StartDir + '\'; IsFound := FindFirst(StartDir+'*.log', faAnyFile-faDirectory, SR) = 0; while IsFound do begin FilesList.Add(StartDir + SR.Name); IsFound := FindNext(SR) = 0; end; FindClose(SR); for i := 0 to FilesList.Count do begin AssignFile(myFile, FilesList.Strings[i]); Reset(myFile); while not Eof(myFile) do begin ReadLn(myFile, strLine); Split(#9,strLine,strListVal); if strListVal.Count = 9 then begin n := StrToInt(strListVal.Strings[0]) - 100; if (n > 0) and (n <= MAX_TP) then begin ar_tppoints[1][n].datetime := strListVal.Strings[2] + ' ' + strListVal.Strings[3]; ... end; end; CloseFile(myFile); end; strListVal.Clear; FilesList.Free; end; |
Vielleicht versteht ja jemand den Fehler.
Vielen Danke fuer eure Hilfe im voraus
Gruss in die weite Welt!
---
Moderiert von
Narses: Beiträge zusammengefasst---
Hi,
ausserdem beim debuggen gibt es in der Zeile 'Strings.DelimitedText := Input;' den Infotext 'Strings.DelimitedText = Function to be called TStrings.GetDelimetedText was elimated by linker'
Heisst das die entsprechende Funktion konnte vom Linker nicht aufgeloest werden?
Gruss