Function nstd_sys::cstring::nstd_cstring_push
source · #[no_mangle]
pub extern "C" fn nstd_cstring_push(
cstring: &mut NSTDCString<'_>,
chr: NSTDChar
) -> NSTDAllocErrorAvailable on crate feature
cstring only.Expand description
Appends an NSTDChar to the end of an NSTDCString.
This will have no effect if chr is a null byte (0).
Parameters:
-
NSTDCString *cstring- The C string. -
NSTDChar chr- The C char to append to the C string.
Returns
NSTDAllocError errc - The allocation operation error code.
Example
use nstd_sys::{
alloc::NSTD_ALLOCATOR,
cstring::{nstd_cstring_new, nstd_cstring_push},
NSTDChar,
};
unsafe {
let mut cstring = nstd_cstring_new(&NSTD_ALLOCATOR).unwrap();
nstd_cstring_push(&mut cstring, b'!' as NSTDChar);
}