Advertisement
Guest User

Untitled

a guest
May 31st, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nim 0.41 KB | None | 0 0
  1.         var
  2.             id: uint64
  3.             inp = @["1", "user", "email"]
  4.        
  5.         #allocate memory for a cstring, the size of the string being copied
  6.         var s1:cstring = cast[cstring] (alloc0((inp[1].len + 1) * sizeof(char)))
  7.  
  8.  
  9.         s1 = inp[1]
  10.         echo $s1
  11.         #Works!
  12.  
  13.         copyMem(cast[pointer](addr s1), addr inp[1], sizeof(s1))
  14.         echo $s1
  15.         #Unicode char?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement