This is why. I asked how to avoid fdopen() in another forum:
----
>> I need to replace some fdopen with something else or link with some library
>> that contains fdopen. I'm running a crosscompiler on Amiga for PPC and I
>> can't emulate fdopen.
>> Anyone have an idea how I can solve it?
MR> Try using fopen on another file and then replacing the fd in the structure
MR> before any I/O on the file. Not actually legal, but may work if you're
MR> desperate.
Another method: do fopen() of devnull, ask fileno() and call dup2().
It requires fileno() which isn't standard C function, but doesn't require
knowledge of struct FILE internals.
------
FILE* fdopen( int fd, const char* method ) {
FILE* f = fopen( "/dev/null", method );
int d, se;
if( !f ) return NULL;
d = fileno(f);
if( dup2( fd, d ) < 0 ) { se = errno; fclose(f); errno = se; return NULL; }
return f;
}