> For the complete documentation index, see [llms.txt](https://mwx.twelite.info/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mwx.twelite.info/v0.1.8/api-reference/functions-1/utility/printf-utils.md).

# Printf utils

mwxライブラリでは、書式出力をC言語で常用されるprintfの実装を用いています。いくつかの関数の関数定義が利用できます。

```cpp
int mwx_printf(const char* format, ...)
int mwx_snprintf(char* buffer, size_t count, const char* format, ...)
```

`mwx_printf()`はSerialオブジェクトに対してprintf出力を行います。`Serial.printfmt()`と同じ処理になります。

`mwx_snprintf()`はバッファに対してsnprintfを行います。

{% hint style="info" %}
配列クラス[smplbuf](/v0.1.8/api-reference/classes/smplbuf.md)に対してprintfでバッファを構築したい場合は、[mwx::streamでデータ生成](/v0.1.8/api-reference/classes/smplbuf.md#mwxstreamdedta)を参照してください。
{% endhint %}
