Category : format

I’m trying to convert some time point to string and back with high precision. I’m using C++20 stl library. It works well with the second precision, but I need milliseconds (or even microseconds) too. Here is my program: #include <chrono> #include <format> #include <iostream> #include <string> #include <sstream> int main(int argc, char* argv[]) { using ..

Read more

it use like in c11/c++?: printf("%2$*11$s",…) It is come from a elf file, this file using printf() to operate like mem[4]=mem[2]+mem[1]. You can refer from this https://ctftime.org/task/5042 (it is a reverse CTF question). To figure out it, I already search for google, bings, baidu and read wiki-printf and c/c++ reference, but still this format type ..

Read more

Let’s assume we have a simple function that takes a std::chrono::time_point and returns a string using a given formatting string. Like so: std::string DateTimeToString(std::chrono::sys_time, const char * szFormat /*= "%Y/%m/%d %H:%M:%S"*/) According to the cppreference documentation of std::formatter we should be able to use the individual tags to create a string like 2021/03/24 15:36:32.123123. However, ..

Read more