-2

Im trying convert numbers into an ip format

e.g 127.0.0.1

my code

fmt::format("{0}", num1, num2, num3, num4)

i didn't expect this to work but i tried it anyways

1 Answers1

3

You just combine them in the format string:

#include <fmt/format.h>

#include <iostream>

int main() { 
    std::cout << fmt::format("{}.{}.{}.{}\n", 127, 0, 0, 1); 
}
Aykhan Hagverdili
  • 28,141
  • 6
  • 41
  • 93