Autor Beitrag
Horschdware
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 744
Erhaltene Danke: 54

Win XP Pro, Win 7 Pro x64
Delphi 7, Delphi XE, C++ Builder 5, SAP R/3
BeitragVerfasst: Mo 08.03.04 01:05 
Folgendes Problem:
Ich habe in einer ini-datei mehrere idents mit recht langen strings. diese sollen nun in ein dynamisches array rein.
ich versuche das folgendermaßen:

ausblenden Delphi-Quelltext
1:
2:
var map : array of array of integer;
i, maxX, maxY : integer;



ausblenden Delphi-Quelltext
1:
2:
 SetLength(map,maxx);
  for i:=0 to maxx do SetLength(map[i],maxy);


irgendiwe kann ich nichts ins array schreiben. ich bekomme dauernd zugriffsverletzungen...
was mach ich falsch?

_________________
Delphi: XE - OS: Windows 7 Professional x64


Zuletzt bearbeitet von Horschdware am Di 09.03.04 17:32, insgesamt 2-mal bearbeitet
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mo 08.03.04 01:07 
Die Indizierung der Elemente eines dynamischen Arrays beginnt bei 0. Das heißt, der höchte zulässige Index eines Arrays mit Länge maxx ist maxx-1. Deine Schleife läuft aber bis maxx, was eines zu weit ist. In der Tutorial-Sparte gibt es auch Tutorial zu Arrays.

Dort steht auch, wie Du die ersten beiden Zeilen kürzer machen kannst:

ausblenden Delphi-Quelltext
1:
SetLength(map, maxx, maxy)					

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
Horschdware Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 744
Erhaltene Danke: 54

Win XP Pro, Win 7 Pro x64
Delphi 7, Delphi XE, C++ Builder 5, SAP R/3
BeitragVerfasst: Di 09.03.04 17:32 
thx
(und wieder ein glücklicher mensch mehr auf dieser welt ^^)

_________________
Delphi: XE - OS: Windows 7 Professional x64
Raphael O.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1596


VS 2013
BeitragVerfasst: Di 09.03.04 17:50 
bin mir nicht ganz sicher, aber in der for-schleife solltest du nur bis maxx-1 hoch gehen, da wenn maxx elemente da sind, was bei null anfängt ist der höchste eben maxx-1 8)
rokdd
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 329

Win XP
D6
BeitragVerfasst: Di 09.03.04 21:26 
@ Fiji-Fighter: genau das gleiche hat Peter auch schon geschrieben! 8)


Robert
Raphael O.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1596


VS 2013
BeitragVerfasst: Di 09.03.04 23:08 
rokdd hat folgendes geschrieben:
@ Fiji-Fighter: genau das gleiche hat Peter auch schon geschrieben! 8)

ach du meine ****
da denkt man man wäre total verblödet (oder bin ichs tatsächlich?? *g*)
da hilft wohl nur genaueres lesen :(
rokdd
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 329

Win XP
D6
BeitragVerfasst: Di 09.03.04 23:25 
du solltest halt mal keine sonnenbrille soondern eine lesebrille zu legen!

robert
Raphael O.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1596


VS 2013
BeitragVerfasst: Mi 10.03.04 00:00 
es geht ja nicht ums erfassen, sondern ums verarbeiten der Daten im Stresszustand :D
Horschdware Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 744
Erhaltene Danke: 54

Win XP Pro, Win 7 Pro x64
Delphi 7, Delphi XE, C++ Builder 5, SAP R/3
BeitragVerfasst: Mi 10.03.04 00:27 
Ach, doppelt hält besser... ^^

_________________
Delphi: XE - OS: Windows 7 Professional x64