fclose.c 277 B

12345678910111213141516
  1. #include <stdio.h>
  2. #include <alloc.h>
  3. __ATTR_LIB_C__ short fclose(FILE *f)
  4. {
  5. short s;
  6. if(!f) return EOF;
  7. s=(f->flags&_F_ERR)?EOF:0;
  8. if(f->flags&_F_WRIT) HeapRealloc(f->handle,(*(unsigned short*)(f->base))+2);
  9. HeapUnlock(f->handle);
  10. free(f);
  11. return s;
  12. }