> I'm not saying I shouldn't have to explicitly handle the file missing case. I'm saying I want to use Maybe and IO and get better at haskell! But now a lot of my code has to take this into account. In C I do this (example found on interwebz):
get_file_size :: FilePath -> IO Int
get_file_size path = do
msize <- fsize path
case msize of
Nothing -> do
hPutStrLn stderr "fsize failed"
exitFailure
Just size -> return size
I want to allocate memory for array of pointers. my question is - if I use malloc of the pointers will be NULL at the beginning? or I need to use calloc for this? Thanks!
helloc all;
I want to allocate memory for array of pointers. my question is - if I use malloc of the pointers will be NULL at the beginning? or I need to use calloc for this? Thanks!