Hi!
Ich bekomme, sobald ich versuche 2 verschiedene Records in eine Datei zu schreiben, folgenden fehler:
Im Projekt HLSS_DB.exe ist eine Exception der Klasse ERangeError aufgetreten. Meldung: 'Fehler bei Bereichsprüfung'.
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: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77:
| type TDatenSatz_Kopf = packed record FileVersion: String[10]; Typ: String[8]; Date: String[10]; Time: String[8]; OffDS: LongWord; end;
type TDatenSatz_Set = packed record id: String[5]; game: String[10]; key: String[100]; wert: String[10]; end;
type TDatenSatz_Map = packed record id: String[5]; game: String[10]; map: String[200]; end;
procedure TMain_Form.DatenbankSpeichern1Click(Sender: TObject); var Daten_Kopf: TDatenSatz_Kopf; Daten_Map: Array of TDatenSatz_Map; Daten_Set: Array of TDatenSatz_Set; MyFile: file of byte; ListItem: TListItem; I: Integer; DS: Integer; begin I := ListView1.Items.Count -1; try AssignFile(MyFile,DBFile); ReWrite(MyFile); Daten_Kopf.FileVersion := FileVersion; Daten_Kopf.Date := Date; Daten_Kopf.Time := Time; Daten_Kopf.Typ := Typ; Daten_Kopf.OffDS := SizeOf(Daten_Kopf); BlockWrite(MyFile,Daten_Kopf,SizeOf(TDatenSatz_Kopf)); if DB = 0 then begin SetLength(Daten_Map,I); for DS := 0 to ListView1.Items.Count -1 do begin ListItem := ListView1.Items.Item[I]; Daten_Map[I].id := ListItem.Caption; Daten_Map[I].game := ListItem.SubItems[0]; Daten_Map[I].map := ListItem.SubItems[1]; BlockWrite(MyFile,Daten_Map[I],SizeOf(TDatenSatz_Map)); end; end; if DB = 1 then begin SetLength(Daten_set,I); for DS := 0 to ListView1.Items.Count -1 do begin ListItem := ListView1.Items.Item[I]; Daten_Set[I].id := ListItem.Caption; Daten_Set[I].game := ListItem.SubItems[0]; Daten_Set[I].key := ListItem.SubItems[1]; Daten_Set[I].wert := ListItem.SubItems[2]; BlockWrite(MyFile,Daten_Set[I],SizeOf(TDatenSatz_Set)); end; end; finally CloseFile(MyFile); end; end; |
Habe schon mehrere Varianten ausprobiert. Keine mit erfolg.
Danke schon mal im Vorraus!