Hi Paul,

If you _do_ want/need to work with C-style null-terminated strings, you can use 
the (core)
NativeCall library.  So, given your example:

> my Buf $b .= new([72, 105, 0, 32, 97, 103, 97, 105, 110, 0]);
> say $b.decode;
> I would expect this to print 'Hi'.
> 
> Instead it prints 'Hi again'.

You can write:

   use NativeCall;
   say nativecast(str, $b) # prints 'Hi'

Hope that helps!

– codesections

Reply via email to