Autor Beitrag
Jukka
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 107

Win XP Pro
Delphi 7
BeitragVerfasst: Di 26.09.06 17:51 
Hallo,

Ich habe eine frage. Ich habe eine 2 Dimensionale Array z.b., string.
Frage ich diese mit sizeof() ab komtm ein immer fester wert, der resavierte wert.

Nun möchte ich jedoch wissen wieviel da "Wirklich" drinnen ist, wenn jetzt z.b. überall nur Hallo Welt stehen würde wäre es ja nicht der feste wert da der rest ja "leer" ist

Geht das?

Jukka
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Di 26.09.06 18:06 
Moin!

Nein, nicht mit String-Arrays, da hier nicht bekannt ist, wie lang jeder einzelne String ist.

Mit String[] oder ShortString geht das auf Basis einer einfachen Multiplikation. ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
soisseteben
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 111

Win XP
D7
BeitragVerfasst: Di 26.09.06 20:49 
oder du addierst die Länge jedes Strings aufeinander ( mit Length() ). Da ein Ascii-Zeichen genau ein Byte belegt, bekommst du so die genaue Länge in Bytes.

_________________
„Wer nur nach dem Zweck der Dinge fragt, wird ihre Schönheit nie entdecken.“ - (Halldór Laxness)