Thread overview
Setting a dynamic array from a pointer to data...
Apr 03, 2006
Paolo Invernizzi
Apr 03, 2006
Oskar Linde
Apr 04, 2006
Paolo Invernizzi
April 03, 2006
Hi all,

I have a unsigned char* buffer from an external library that I know is sized, for example, 100.

What is the best way to turn it in a ubyte[] dynamic array?

Thanks

---
Paolo
April 03, 2006
Paolo Invernizzi skrev:
> Hi all,
> 
> I have a unsigned char* buffer from an external library that I know is sized, for example, 100.
> 
> What is the best way to turn it in a ubyte[] dynamic array?

ubyte *buffer = whatever();

ubyte[] dynBuffer = buffer[0..100];

/Oskar
April 04, 2006
And no copy is appening I guess?

Oskar Linde wrote:
> Paolo Invernizzi skrev:
>> Hi all,
>>
>> I have a unsigned char* buffer from an external library that I know is sized, for example, 100.
>>
>> What is the best way to turn it in a ubyte[] dynamic array?
> 
> ubyte *buffer = whatever();
> 
> ubyte[] dynBuffer = buffer[0..100];
> 
> /Oskar
April 04, 2006
"Paolo Invernizzi" <arathorn@NOSPAM_fastwebnet.it> wrote in message news:e0tta5$17m2$1@digitaldaemon.com...
> And no copy is appening I guess?

Nope.  It just sets the dynamic array's pointer to that data.