Newsgroups : Borland : borland.public.delphi.rtl.win32 : 2008 Apr : Copy an array of byte to a widestring
| Subject: | Copy an array of byte to a widestring |
| Posted by: | "Andrew Fiddian-Green" (..@dd) |
| Date: | Fri, 18 Apr 2008 19:49:59 |
If I want to copy an array of byte to an AnsiString I use the following
code:
var
data: array of byte;
S: AnsiString;
SetString(S, PChar(@data[0]), Length(data));
My question is how to copy an array of bytes to a widestring? Is the
following correct? (I think it is probably not...)
var
data: array of byte;
W: widestring;
SetString(W, PWideChar(@data[0]), Length(data) div 2);
Any help is much appreciated.
AndrewFG