#[unsafe(no_mangle)]pub const extern "C" fn nstd_core_cstr_get(
cstr: &NSTDCStr,
pos: NSTDUInt,
) -> *const NSTDCharAvailable on crate feature
core only.Expand description
Return a pointer to the character at index pos in cstr.
§Parameters:
-
const NSTDCStr *cstr- The C string. -
NSTDUInt pos- The position of the character to get.
§Returns
const NSTDChar *chr - A pointer to the character at pos, or null if pos is out of the C
string slice’s boundaries.
§Example
use nstd_sys::core::cstr::{nstd_core_cstr_from_raw_with_null, nstd_core_cstr_get};
let s_str = "AMP\0";
unsafe {
let cstr = nstd_core_cstr_from_raw_with_null(s_str.as_ptr().cast());
let nb = nstd_core_cstr_get(&cstr, s_str.len() - 1);
assert!(!nb.is_null());
assert!(*nb == 0);
}