Guest User

Untitled

a guest
Dec 14th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. extern crate libc;
  2. use std::ffi::CStr;
  3. use libc::c_char;
  4.  
  5. unsafe fn test(str_ptr: *const c_char) {
  6. let var: Vec<u8> =CStr::from_ptr(str_ptr)
  7. .to_bytes()
  8. .iter()
  9. .map(|i| *i)
  10. //.clone()
  11. .collect();
  12.  
  13. }
  14.  
  15. fn main() {
  16. unsafe {
  17. test(std::ptr::null());
  18. }
  19. }
Add Comment
Please, Sign In to add comment