Re: Memorystream to widestring



function StreamToWideString(AStream: TStream): WideString;
var
r : TReader;
begin
r := TReader.Create(AStream);
result := r.ReadWideString;
r.FRee;
end;

should work

regards
Toon


"Costa" <costakaramalis@xxxxxxxxxxxxxxxxx> wrote in message
news:b68771l5n65btpjfigahrf5kceeg5ktbpt@xxxxxxxxxx
> 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