variations to convert C pointer to Nim string, and perhaps faster too:
    
    
    proc fromCString(p: pointer, len: int): string =
      result = newString(len)
      for i in 0.. <len:
        result[i] = cast[cstring](p)[i]
    

or
    
    
    proc fromCString(p: pointer, len: int): string =
      result = newString(len)
      copyMem(result.cstring, p, len)
    

Reply via email to