Thread overview | ||||||
---|---|---|---|---|---|---|
|
April 03, 2006 Setting a dynamic array from a pointer to data... | ||||
---|---|---|---|---|
| ||||
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 Re: Setting a dynamic array from a pointer to data... | ||||
---|---|---|---|---|
| ||||
Posted in reply to Paolo Invernizzi | 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 Re: Setting a dynamic array from a pointer to data... | ||||
---|---|---|---|---|
| ||||
Posted in reply to Oskar Linde | 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 Re: Setting a dynamic array from a pointer to data... | ||||
---|---|---|---|---|
| ||||
Posted in reply to Paolo Invernizzi | "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. |
Copyright © 1999-2021 by the D Language Foundation