Autor Beitrag
reg107
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 36



BeitragVerfasst: Sa 26.03.05 14:57 
Hallo,
ich lese mit readln eine Zeile aus einer Datei aus. Wie finde ich jetzt die Größe der Zeile (in byte) heraus?

Gruß,
reg107
delfiphan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2684
Erhaltene Danke: 32



BeitragVerfasst: Sa 26.03.05 15:02 
Du liest die Zeile in einen String und findest die Länge mit length raus.
huhn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 272
Erhaltene Danke: 1

WIN XP
D7Pers
BeitragVerfasst: Sa 26.03.05 15:10 
ich dachte des gibt nur die anzahl der buchstaben als integer wieder und nicht die byte-größe?? :?:
hab des in der hilfe gefunden
ausblenden Delphi-Quelltext
1:
function CharToByteLen(const S: string; MaxLen: Integer): Integer;					

mfg huhn
delfiphan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2684
Erhaltene Danke: 32



BeitragVerfasst: Sa 26.03.05 15:14 
Länge des (Ansi)Strings = Grösse des String-Inhalts in Bytes.
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 26.03.05 15:22 
Ansi: Ein Zeichen = ein Byte.
UniCode: Ein Zeichen = zwei Byte.
Karlson
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 2088



BeitragVerfasst: Sa 26.03.05 15:26 
Ergänzend, nur falls du vor hast irgendwas mim Speicher zu treiben (getMem oder fillchar oder sowas), dann hol dir die grösse der Variable mit SizeOf. SizeOf gibt an wieviel Speicher nötig ist um die Variable darzustellen (bei einem String immer 4 Byte weil 255 als maximal länge, es sei denn widestring).

Die Grösse der Zeile bekommst du wie bereits von Delphiphan erklärt.