Tim, do you want to go from string to char[] or char[] to string?
for string to char[] you can use string.ToCharArray();
for char[] to string you can use the string constructor which takes a
char[].
Hope that helps.
--
Greg Ewing [MVP]
http://www.citidc.com
"Tim Conner" <timconner@hotmail.com> wrote in message
news:#qbMtYKhDHA.3764@tk2msftngp13.phx.gbl...[color=blue]
>
>
> Hi,
>
> I am an ex-delphi programmer, and I having a real hard time with the
> following simple code (example ):
>
> Which is the equivalent to the following code ?
>
> var
> chars : PChar;
> sBack, s : String;
> begin
> s := Tim Conner XXXXXXXXX';
> chars := AllocMem(20);
>
> Move( s[1], chars^, 20); <<-- This
> sBack := chars; <<-- and this
>
> ShowMessage(sBack);
> FreeMem(chars, 20);
>
>
> I could write a "move" function to put each character of the string into[/color]
the[color=blue]
> char*, eventhough I would prefer the more appropiate approach.
> But what really worries me, is how to take the content of the PChar ( C# =
> char* ) and put it back in to the string ??
>
>
> Thanks in advance,
>
>
>
>
>[/color]