I am using Delphi XE3, and with the following code:
function Test(): string;
var
Buffer: array[0..5] of WideChar;
BufferLen: Cardinal;
TempStr: UnicodeString;
begin
SetString(TempStr, PWideChar(@Buffer[0]), BufferLen / 2);
end;
I always get the following error:
[dcc32 Error] Translator.pas(148): E2008 Incompatible types
But I check Does SetString have two version for AnsiString and UnicodeString accordingly? and confirm there are two versions of SetString, why does not work for Unicode?