Memorystream to widestring



Hi all,

how can I copy the contents of a memorystream into a widestring?
I can do it for a string, but widestring doesnt work.

procedure TForm1.Button1Click(Sender: TObject);
var
SourceString: widestring;
MemoryStream: TMemoryStream;
begin
.....
MemoryStream.Position := 0;
SetLength(SourceString, MemoryStream.Size);
MemoryStream.ReadBuffer(Pointer(SourceString)^,MemoryStream.Size);
Caption := SourceString;
....

Can someone help me out? I m stuck.

Thank you.
.


Quantcast