When I have a [*]u8 pointer and a usize length, how do I convert the pointer to a []u8 slice with the specified length?
When I have a [*]u8 pointer and a usize length, how do I convert the pointer to a []u8 slice with the specified length?
Use the slice syntax on the [*]u8 pointer:
fn to_slice(pointer: [*]u8, len: usize) []u8 {
return pointer[0..len];
}