These are chat archives for fmtlib/fmt

10th
Sep 2015
Naav
@Naav
Sep 10 2015 08:33
Hi, I'm looking for a way of replacing the following example: printf("%*.*s", sizeof(buf), sizeof(buf), buf) with cppformat. Is it possible?
Naav
@Naav
Sep 10 2015 09:09
This message was deleted
Found it: {:.{}}
Victor Zverovich
@vitaut
Sep 10 2015 16:31
@Naav Either of the following will have the same behavior:fmt::printf("%.s", sizeof(buf), sizeof(buf), buf);
or fmt::print("{:>{}.{}}", buf, sizeof(buf), sizeof(buf));
Actually even better, because the type of precision and width argument should be int in standard printf rather than size_t while C++ Format handles any integral type.