Sprintf(char const* format, V1 const& v1, V2 const& v2, V3 const& v3) : std::string(first_buflen, '\0') { unsigned size = (unsigned)C99snprintf(buf(), buflen, format, v1, v2, v3); if (size >= first_buflen) { unsigned heapsz = size + 1; resize(heapsz); size = C99snprintf(buf(), heapsz, format, v1, v2, v3); } resize(size); }
/** TODO Make this work on non-unix platforms too */ MemoryInfo::MemoryInfo() { C99snprintf(memoryFilename, buflen - 1, "/proc/%d/stat", getpid()); }