convert string to ubyte[]

user1234 user1234 at 12.nl
Sat Nov 11 17:12:46 UTC 2017


On Saturday, 11 November 2017 at 15:48:59 UTC, Mike Parker wrote:
> On Saturday, 11 November 2017 at 15:38:18 UTC, aki wrote:
> auto bytes = cast(immutable(ubyte)[])s;
>
> Of course, if you need a mutable array you should dup:
>
> auto bytes = cast(ubyte[])s.dup;

Not only "should" but he "must" otherwise with string literals 
he'll get a violation access error.


More information about the Digitalmars-d-learn mailing list