MicroHs-0.17.4.0 / tests / CString.hs
module CString whereimport Data.ByteStringimport Foreign.C.Stringimport Foreign.Marshal.Allocmain :: IO ()main = do (cstr, len) <- newCStringLen "hello" print $ len == 5 bs1 <- packCString cstr bs2 <- packCStringLen (cstr, len) s1 <- peekCString cstr s2 <- peekCStringLen (cstr, len) print (bs1, bs2) print (s1, s2) free cstr print (bs1, bs2) print (s1, s2)