Re: TStringGrid
- From: alanglloyd@xxxxxxx
- Date: 14 Apr 2005 05:24:40 -0700
That code I posted was really dubious - I had similarly been hit by a
zero length string and so the code in my utility file ia now ...
procedure WriteStreamStr(Stream : TStream; Str : string);
{writes a string to the stream}
var
StrLen : integer;
begin
{get length of string}
StrLen := Length(Str);
{write length of string}
WriteStreamInt(Stream, StrLen);
if StrLen > 0 then
{write characters}
Stream.WriteBuffer(Str[1], StrLen);
end;
function ReadStreamStr(Stream : TStream) : string;
{returns a string from the stream}
var
LenStr : integer;
begin
Result := '';
{get length of string}
LenStr := ReadStreamInt(Stream);
{set string to get memory}
SetLength(Result, LenStr);
if (LenStr = 0) then
Exit;
{read characters}
Stream.ReadBuffer(Result[1], LenStr);
end;
Alan Lloyd
.
- References:
- TStringGrid
- From: Anthony
- Re: TStringGrid
- From: alanglloyd
- Re: TStringGrid
- From: J French
- Re: TStringGrid
- From: alanglloyd
- Re: TStringGrid
- From: J French
- TStringGrid
- Prev by Date: Select printer
- Next by Date: Re: Select printer
- Previous by thread: Re: TStringGrid
- Next by thread: Rich Edit and Symbol Fonts
- Index(es):
Relevant Pages
|