1 The `ffi.copy()` function copies memory between C data objects. 2 3 Copy memory between buffers. 4 5 -- Testcase -- 6 {% 7 import * as ffi from 'ffi'; 8 9 ffi.cdef('typedef char chararr[5];'); 10 let src = ffi.ctype('chararr', [104, 101, 108, 108, 111]); // "hello" 11 let dst = ffi.ctype('chararr'); 12 13 ffi.copy(dst.ptr(), src.ptr(), 5); 14 print("copied: ", ffi.string(dst.ptr(), 5), "\n"); 15 -- End -- 16 17 -- Expect stdout -- 18 copied: hello 19 -- End -- 20
This page was automatically generated by LXR 0.3.1. • OpenWrt