FILE* fdopen( int fd, const char* mode ) { int flags; if ( fd < 0 ) { errno = -EINVAL; return NULL; } flags = __parse_mode( mode ); return __init_file( fd, 0, flags ); }
FILE* fopen( const char* path, const char* mode ) { int fd; int flags; flags = __parse_mode( mode ); fd = open( path, flags, 0666 ); if ( fd < 0 ) { return NULL; } return __init_file( fd, 1, flags ); }