How to format struct timespec to string? This structure is returned e.g. by clock_gettime() on Linux gcc:
struct timespec
clock_gettime()
struct timespec { tim
You could use a std::stringstream. You can stream anything into it:
std::stringstream stream; stream << 5.7; stream << foo.bar; std::string s = stream.str();
That should be a quite general approach. (Works only for C++, but you asked the question for this language too.)