반응형
int
sprintf(char *str, const char *fmt, ...)
#include <stdio.h> #include <string.h> #include <stdarg.h> #include <limits.h> #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 = f._p = (unsigned char *)str; f._bf._size = f._w = INT_MAX; va_start(ap, fmt); ret = vfprintf(&f, fmt, ap); va_end(ap); *f._p = '\0'; return (ret); }
반응형