byte* and int length -> byte[]

mimocrocodil 4denizzz at gmail.com
Mon Aug 15 10:16:54 PDT 2011


I obtain immutable(byte)* and int where contained length of bytes block from C library.

Can I convert this into byte[] without explict copying etc.

Something like:

byte* p; // bytes
int size; // size of bytes block

byte[] b;
b.length = size;
b.ptr = p;

// now b contains bytes from library


More information about the Digitalmars-d-learn mailing list