Talk:System.SetString
Length Parameter
The explanation refers to the "Len" parameter rather than the "Length" parameter. Philip J. Rayment 15:51, 12 February 2012 (PST)
The problem was fixed. Thank you! -- Denisa Tibeica
Also works for AnsiString
The compiler also accepts
procedure SetString(var S: AnsiString; Buffer: PAnsiChar; Length: Integer);
Davidmarcus 06:57, 18 March 2012 (PDT)
Prior to Delphi 2009, PAnsiChar and PChar were both pointers to a AnsiChar. Now, they point to different things (AnsiChar and Char).
For long term code compatibility with future versions, I would go with giving SetString a PChar parameter for Buffer.