분류 전체보기683 sprintf int sprintf(char *str, const char *fmt, ...) #include #include #include #include #include "local.h" #if defined(APIWARN) __warn_references(sprintf, "warning: sprintf() is often misused, please use snprintf()"); #endif int sprintf(char *str, const char *fmt, ...) { int ret; va_list ap; FILE f; struct __sfileext fext; _FILEEXT_SETUP(&f, &fext); f._file = -1; f._flags = __SWR | __SSTR; f._bf._base .. 2016. 7. 9. sscanf int sscanf(const char *str, const char *fmt, ...) #include 2016. 7. 9. stdio stdio #include #include #include #include "local.h" /* * Small standard I/O/seek/close functions. * These maintain the `known seek offset' for seek optimisation. */ int __sread(void *cookie, char *buf, int n) { FILE *fp = cookie; int ret; ret = read(fp->_file, buf, n); /* if the read succeeded, update the current offset */ if (ret >= 0) fp->_offset += ret; else fp->_flags &= ~__SOFF;/* paranoia .. 2016. 7. 9. tmpnam char * tmpnam(char *s) #include #include #include __warn_references(tmpnam, "warning: tmpnam() possibly used unsafely; consider using mkstemp()"); extern char *_mktemp(char *); char * tmpnam(char *s) { static u_long tmpcount; static char buf[L_tmpnam]; if (s == NULL) s = buf; (void)snprintf(s, L_tmpnam, "%stmp.%lu.XXXXXXXXX", P_tmpdir, tmpcount); ++tmpcount; return (_mktemp(s)); } 2016. 7. 9. 이전 1 ··· 142 143 144 145 146 147 148 ··· 171 다음