[#absl-FormatCountCapture] = xref:absl.adoc[absl]::FormatCountCapture :relfileprefix: ../ :mrdocs: Safely wraps `StrFormat()` captures of `%n` conversions into an integer value. == Synopsis Declared in `<absl/strings/str_format.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class FormatCountCapture; ---- == Description `%n` conversions denote the number of characters written by a formatting operation to this point. This wrapper is designed to allow safe usage of `%n` within `StrFormat(); in the `printf()` family of functions, `%n` is not safe to use, as the `int *` buffer can be used to capture arbitrary data. Example: int n = 0; std::string s = absl::StrFormat("%s%d%n", "hello", 123, absl::FormatCountCapture(&n)); EXPECT_EQ(8, n); == Member Functions [cols="1,4"] |=== | Name| Description | xref:absl/FormatCountCapture/2constructor.adoc[`FormatCountCapture`] [.small]#[constructor]# | Constructs a capture that writes the character count to `p`. |=== == Friends [cols="1,4"] |=== | Name| Description | `absl::str_format_internal::FormatCountCaptureHelper` | |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#