분류 전체보기683 fread size_t fread(void *buf, size_t size, size_t count, FILE *fp) #include #include #include "local.h" size_t fread(void *buf, size_t size, size_t count, FILE *fp) { size_t resid; char *p; int r; size_t total; /* * The ANSI standard requires a return value of 0 for a count * or a size of 0. Peculiarily, it imposes no such requirements * on fwrite; it only requires fread to be broken. */ if ((resid = .. 2016. 7. 9. fputc int fputc(int c, FILE *fp) #include #include #include "local.h" int fputc(int c, FILE *fp) { if (cantwrite(fp)) { errno = EBADF; return (EOF); } return (putc(c, fp)); } 2016. 7. 9. fseek int fseek(FILE *fp, long offset, int whence) #include #include #include #include #include #include #include "local.h" #definePOS_ERR(-(fpos_t)1) /* * Seek the given file to the given offset. * `Whence' must be one of the three SEEK_* macros. */ int fseeko(FILE *fp, off_t offset, int whence) { fpos_t (*seekfn)(void *, fpos_t, int); fpos_t target, curoff; size_t n; struct stat st; int havepos; /* .. 2016. 7. 9. _fwalk int _fwalk(int (*function)(FILE *)) #include #include #include "local.h" #include "glue.h" int _fwalk(int (*function)(FILE *)) { FILE *fp; int n, ret; struct glue *g; ret = 0; for (g = &__sglue; g != NULL; g = g->next) for (fp = g->iobs, n = g->niobs; --n >= 0; fp++) if (fp->_flags != 0) ret |= (*function)(fp); return (ret); } 2016. 7. 9. 이전 1 ··· 137 138 139 140 141 142 143 ··· 171 다음