1 2 3 4 5 6 7 8 9 10 11 12
#include "stdioint.h" int fileno(FILE *file) { struct _IO_file_pvt *f = stdio_pvt(file); if (f->isfile) return (int)(intptr_t)f->cookie; errno = EBADF; return -1; }