]> git.sur5r.net Git - cc65/blob - libsrc/common/fclose.c
Copy TGI drivers into main lib dir
[cc65] / libsrc / common / fclose.c
1 /*
2  * int fclose (FILE* f);
3  */
4
5
6
7 #include <fcntl.h>
8 #include <errno.h>
9 #include "_file.h"
10
11
12
13 int fclose (FILE* f)
14 {
15     if ((f->f_flags & _FOPEN) == 0) {
16         /* File is not open */
17         _errno = EINVAL;                /* File not input */
18         return EOF;
19     }
20
21     /* Reset the flags and close the file */
22     f->f_flags = _FCLOSED;
23     return close (f->f_fd);
24 }
25
26
27