Convert binary to UUID from LDAP
Jacob Shtokolov
jacob.100205 at gmail.com
Tue Mar 28 09:45:30 UTC 2023
On Tuesday, 28 March 2023 at 05:05:58 UTC, Alexander Zhirov wrote:
> `Error: cannot cast expression 'cast(ubyte*)arr' of type
> 'ubyte*' to 'ubyte[16]'`
Here is the working example:
```d
import std.stdio;
import std.uuid;
void main()
{
ubyte[] arr = [159, 199, 22, 163, 13, 74, 145, 73, 158, 112, 7,
192, 12, 193, 7, 194];
UUID(arr[0 .. 16]).writeln;
}
```
You just need to take a slice of your array to guarantee that it
has only 16 elements, and thus, pass it to `UUID`.
More information about the Digitalmars-d-learn
mailing list