// Lesen alt
function THKStreams.ReadStr(Stream: TStream):
String;
var
I: Word;
S:
String;
begin
Stream.ReadBuffer(I, SizeOf(I));
Setlength(S, I);
Stream.ReadBuffer(PChar(S)^, I);
Result := S;
end;
// Angepasst für Delphi 2010 (Unicode)
function THKStreams.ReadStr(Stream: TStream):
String;
var
I: Word;
S:
String;
begin
Stream.ReadBuffer(I, SizeOf(I));
Setlength(S, I);
Stream.ReadBuffer(Pointer(S)^, I * SizeOf(Char));
Result := S;
end;
// Schreiben alt
procedure THKStreams.WriteStr(S:
String; Stream: TStream);
var
I: Word;
begin
I := Length(S);
Stream.WriteBuffer(I, SizeOf(I));
Stream.WriteBuffer(PChar(S)^, I);
end;
// Angepasst für Delphi 2010 (Unicode)
procedure THKStreams.WriteStr(S:
String; Stream: TStream);
var
I: Word;
begin
I := Length(S);
Stream.WriteBuffer(I, SizeOf(I));
Stream.WriteBuffer(Pointer(S)^, I * SizeOf(Char));
end;