Do it this way:
SetLength (s, 10); // set desired size of the string
Move (buf[8], s[1], 10); // "Buf" uses 0-indexing, so to get the
9th character refer to position 8
At 09:43 PM 3/17/2007, you wrote:
>Pointer in Delphi is one of the things that I'm not
>so sure about anytime I use one.
>
>Suppose I have a data buffer, and I'd like to copy
>byte 10 to 20 of the data buffer to a string. What
>is the best way to do it?
>
>var Buf: Array [0..65535] of Byte; s: String;
>begin
> // modify value in buf
> ...
>
> // How to copy Buf[9..19] to String s?
> s := Copy(Buf, 9, 10); // this gets an "Incompatible types" error
>
> // Use s here
> ...
>end;
>
>--
>Best regards,
>Jack
Regards,
Sid Gudes
PIA Systems Corporation
[EMAIL PROTECTED]
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi