Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extern crate libc;
- use std::ffi::CStr;
- use libc::c_char;
- unsafe fn test(str_ptr: *const c_char) {
- let var: Vec<u8> =CStr::from_ptr(str_ptr)
- .to_bytes()
- .iter()
- .map(|i| *i)
- //.clone()
- .collect();
- }
- fn main() {
- unsafe {
- test(std::ptr::null());
- }
- }
Add Comment
Please, Sign In to add comment