
14 Apr
2024
14 Apr
'24
4:16 p.m.
On Sun, 14 Apr 2024, Folsk Pratima wrote:
tryIOString :: CSize -> IO (Maybe String) tryIOString size = allocaBytes (fromIntegral size) $ \ptr -> do zeroptr <- memSet ptr 0 (fromIntegral size)
You may instead do withArray (replicate (fromIntegral size) 0) $ \ptr -> do st <- c_strerror_r (fromIntegral errnum) ptr size ...