Replace fdopen by conversion to CFILE