Skip to main content

charp2bytes

Function charp2bytes 

Source
pub unsafe fn charp2bytes(ptr: *const c_char) -> Vec<u8> ⓘ
Expand description

Every byte of a NUL-terminated C string, CHAR_MAX included.

localeconv().grouping spells a “repeat last group” / “stop” terminator as CHAR_MAX. Stopping at that value drops the distinction; this reader keeps it, the way a NUL-only C-string walk does.

§Safety

ptr must be null or point to a NUL-terminated C string that remains valid for the duration of the call.