Hello,

Subject maybe not technically correct, but there is something where
I have no explanation for it:

procedure Test(const S: string);
begin
   WriteLn(Length(S));
end;

procedure TForm1.FormCreate(Sender: TObject);
var
   P: PChar;
begin
   AllocConsole;
   GetMem(P, 512);
   FillChar(P^, 511, ' ');
   P[511] := #0;
   Test(P + ^Z);           // displays 256
   Test(string(P) + ^Z);   // displays 512 wich is correct
   FreeMem(P);
end;

Wy is the length of the first string only 256 ?
I try this in Delphi 7.

---
Rgds, Wilfried
http://www.mestdagh.biz

__________________________________________________
Delphi-Talk mailing list -> Delphi-Talk@elists.org
http://www.elists.org/mailman/listinfo/delphi-talk

Reply via email to