macro_rules! c_ptr { ($s:expr) => { ... }; }
Expand description
Returns a *const std::ffi::c_char constructed from the provided literal
with a nul byte appended to the end. Use this to pass static c-strings when
working with ffi.
§Example
extern "C" {
fn strlen(s: *const std::ffi::c_char) -> usize;
}
let count = unsafe { strlen(c_ptr!("foo bar")) };
assert_eq!(count, 7);Same as c_str!, this macro will check at compile time if the string
literal contains any interior nul bytes.