[#absl-FormatCountCapture]
= xref:absl.adoc[absl]::FormatCountCapture
:relfileprefix: ../
:mrdocs:

Safely wraps `StrFormat()` captures of `%n` conversions into an integer value&period;

== Synopsis

Declared in `&lt;absl&sol;strings&sol;str&lowbar;format&period;h&gt;`

[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&period;

This wrapper is designed to allow safe usage of `%n` within &grave;StrFormat()&semi; in the `printf()` family of functions, `%n` is not safe to use, as the `int &ast;` buffer can be used to capture arbitrary data&period;

Example&colon;

int n &equals; 0&semi; std&colon;&colon;string s &equals; absl&colon;&colon;StrFormat(&quot;%s%d%n&quot;, &quot;hello&quot;, 123, absl&colon;&colon;FormatCountCapture(&amp;n))&semi; EXPECT&lowbar;EQ(8, n)&semi;

== 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`&period;
|===


== Friends

[cols="1,4"]
|===
| Name| Description
| `absl::str&lowbar;format&lowbar;internal::FormatCountCaptureHelper`
| 
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
