/      日本語

mwx::mwx_format

printf format input
This is a helper class that writes format specifiers for the << operator of mwx::stream.

Within the library, it is aliased as Using format=mwx::mwx_format;.

Serial << format("formatted print: %.2f", (double)3123 / 100.) << mwx::crlf;

// formatted print: 31.23[newline]
  • Store the argument list received by the constructor into internal class variables using parameter pack expansion
  • When operator << is called, call fctprintf() and write data to the stream

Constructor

format(const char *fmt, ...)

The constructor saves the format pointer and parameters. The following << operator call interprets the format and performs output processing.

ParameterDescription
fmtFormat string. See TWESDK/TWENET/current/src/printf/README.md
...Parameters corresponding to the format string.
※ The maximum number is 4; using 5 or more parameters will cause a compile error. ※ Consistency with the format is not checked, so unsafe for inconsistent input.