[#BloombergLP-bslstl-to_chars]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::to&lowbar;chars
:relfileprefix: ../../
:mrdocs:

Write the specified `value` into the character buffer `&lsqb;first, last)&rsqb;`&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;charconv&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class INTEGRAL&lowbar;TYPE&gt;
xref:BloombergLP/bslstl/to_chars_result.adoc[to&lowbar;chars&lowbar;result]
to&lowbar;chars(
    char* first,
    char* last,
    INTEGRAL&lowbar;TYPE value,
    int base = 10);
----

== Description

Optionally specify `base`, the base in which the number is to be written&period; If `base` is not specified, decimal is used&period; Return a `to&lowbar;chars&lowbar;result` `struct` indicating success or failure, and the end of the written result&period; On success, the output string is to begin at `first`, the `ptr` field in the return value is to point at the end of the representation, and the `ec` field will be 0&period; If the buffer specified by `&lsqb; first &period;&period; last )&rsqb;` is not large enough for the result, return a `struct` with `ptr` set to `last` and `ec` set to `errc&colon;&colon;value&lowbar;too&lowbar;large`&period; Insufficient room in the output buffer is the only failure mode&period; The behavior is undefined unless `first &lt; last` and `base` is in the range `&lsqb; 2 &period;&period; 36 &rsqb;`&period;

== Return Value

a `to&lowbar;chars&lowbar;result` indicating success or failure and the end of the written representation

== Parameters

[cols="1,4"]
|===
| Name| Description
| *first*
| beginning of the character buffer to write into
| *last*
| end of the character buffer to write into
| *value*
| integral value to convert to characters
| *base*
| numeric base for the conversion, in the range `&lsqb;2 &period;&period; 36&rsqb;`
|===


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