In the following code I open a file with 'fopen', and later close it
with 'fclose1':

val fp = fopen(argv[0], file_mode_r)
val () = assertloc(FILEptr2ptr(fp) > 0)
val (pf_r | r) = fclose1(fp)
if r < 0 then let
    prval Some_v pf = pf_r
    prval () = __destroy(pf) where { extern prfun __destroy
{l:addr}{m:fm} (pf: FILE_v(l,m)): void }
   in () end
 else let
     prval None_v () = pf_r
   in () end

In the error handling part of the 'if' I get a FILE_v - to consume it
I've created a local proof function - is this the right approach? What
can I actually do with that FILE_v proof? I couldn't find any obvious
function that removes it. Or am I handling the 'flcose1' completely
wrong?

-- 
http://bluishcoder.co.nz

-- 
You received this message because you are subscribed to the Google Groups 
"ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/CALn1vHG03SF9Q5%2B1LV6qrAqQnp0Uv%2BThZhSRPmZLv0J0-23zvw%40mail.gmail.com.

Reply via email to