Use something like:
var
errBuf = newStringOfCap(256)
retCode = do_something(..., errBuf.cstring)
if retCode < 0:
# if the API doesn't tell us about the size ... but it really should!
errBuf.setLen(len(cstring(errBuf))
echo "ERROR: ", errBuf
- Providing writable string buffer to a foreign C-function olwi
- Re: Providing writable string buffer to a foreign C-func... Araq
