Questions tagged [fmt]

The {fmt} formatting library and the C++ text formatting and output facility (C++20 `std::format` and C++23 `std::print`).

{fmt} is an open source formatting library for . It is similar in functionality to and sprintf. The formatting facility defined in the <format> header is based on it and provides a subset of {fmt}'s functionality.

259 questions
0
votes
1 answer

Is there a way to perform operations on a file opened with fopenf using stream operators?

I have a large C++ codebase that opens various files using the fopenf command (returning a FILE*), and performs operations throughout the code such as writing to and reading from the files using fputc, fgetc, etc. There are also a large amount of…
wand_swe
  • 43
  • 5
0
votes
1 answer

Getting extra newlines with fmt in Windows

I started using fmt for printing recently. I really like the lib, fast, easy to use. But when I completed my conversion, there are ways that my program can run that will render with a bunch of additional newlines. It's not every case, so this will…
0
votes
1 answer

fmt linking for dummies

I'd like to make a python-like dynamic integer class in C++ as an experiment. It requires me to change many integers to string types. As in here: https://www.zverovich.net/2013/09/07/integer-to-string-conversion-in-cplusplus.html it states that fmt…
bartx 3
  • 41
  • 5
0
votes
1 answer

Cannot format an argument on ESP32 architecture

I'm trying to use fmt with ESP32 toolchain (xtensa 32bit GCC with Cxx11 support - see https://github.com/espressif/esp-idf for mode details). Unfortunately they have their own "flavor" of CMake…
shrpq
  • 467
  • 3
  • 8
0
votes
4 answers

{fmt} How to install and use fmtlib in Visual Studio?

I am trying to install fmtlib and I have downloaded the zip folder and extracted it, what do I do next to use it in my Visual Studio 2022 project? Because it's my first time installing an external library. Im using windows 10.
Felierix
  • 179
  • 3
  • 12
0
votes
1 answer

C++ FMT issue formatting a custom abstract class

I'm working on an events system for a personal project and I'm trying to make the events be logged to a console as easy as LOG(event). In this case, events are defined by an Event class which has some methods and a virtual ToString() function that…
LuchoSuaya
  • 77
  • 10
0
votes
2 answers

What is the correct way to use fmt::sprintf?

I'm trying to optimize my software and to do that I need to change the way I store and draw things. Many people say that fmt is way faster than iostream at doing those things, yet I'm sitting here and trying to understand what I did wrong. The old…
user17198097
0
votes
1 answer

{fmt} can implicitly convert a class but not a vector of that class

So I have the following struct: struct Snowflake { Snowflake() : _value(0) {} Snowflake(uint64_t value) : _value(value) {} Snowflake(std::string value) : _value(std::stoull(value)) {} Snowflake(const Snowflake &) = default; …
Aido
  • 1,524
  • 3
  • 18
  • 41
0
votes
1 answer

Passing varargs

The below is a simple logger class I implemented my project. /* g++ test.cpp -o test */ #include #include #include "fmt/fmt.h" typedef enum Severity { LOG_INFO = 0, LOG_WARNING, LOG_ERROR } Severity; class…
Ray Siplao
  • 199
  • 8
0
votes
1 answer

How to build MTd lib for fmt format library?

I am trying to use the following library here: https://github.com/fmtlib/fmt It builds OK using the cmake file provided. But as part of the build it generates fmtd.lib file, which by default is in MD Dynamic Library format. I need to rebuild it to…
Irbis77
  • 163
  • 1
  • 8
0
votes
1 answer

problem with including fmt library in several cpp files

Good day! I installed the fmt library in Ubuntu. Added it in my project #include "fmt/core.h" #include "fmt/format.h" #include "fmt/format-inl.h" to use fmt::format_int и fmt::format. I added library headers in several cpp files of my project.…
0
votes
3 answers

How to format {} in a json string using fmt?

I am trying to format a JSON string avoiding using fmt::format because json does include {0}'s and fmt cannot distinguish JSON's bracket from format specifier {0}'s brackets. If use fmt::format i get the following error: terminate called after…
no more sigsegv
  • 468
  • 5
  • 17
0
votes
1 answer

Understand fmt formatter parse function

I'm trying to under the parse function for creating a formatter for a custom type in fmt. In their documentation (https://fmt.dev/dev/api.html) there is this line that has some sort of loop construct I haven't seen before: auto it = ctx.begin(), end…
schrödinbug
  • 692
  • 9
  • 19
0
votes
0 answers

Visual Studio Code intellisense does not recognize parts of header files because of #if

I have problem with visual studio code and fmt library for c++. I get the library to work but my intellisense does not show/fill fmt/os.h header's functions when writing, And the reason for that is these lines in the os.h header I use win10 and…
0
votes
1 answer

Need help completing command line installation of {fmt} on Windows 10

I'm a Linux user who's trying to set up a dev environment on Windows. I've cloned the fmt repo and built it the way I'm used to on Linux: C:\Users\me\Development> git clone https://github.com/fmtlib/fmt.git C:\Users\me\Development> cd…
Chrinkus
  • 11
  • 3