[#BloombergLP-balber-BerUtil_IntegerImpUtil-putIntegerGivenLength]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/balber.adoc[balber]::xref:BloombergLP/balber/BerUtil_IntegerImpUtil.adoc[BerUtil&lowbar;IntegerImpUtil]::putIntegerGivenLength
:relfileprefix: ../../../
:mrdocs:

Write exactly the specified `length` number of contents octets of the BER encoding of the specified integer `value` (as defined in the specification) to the&period;

== Synopsis

Declared in `&lt;balber&lowbar;berutil&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename INTEGRAL&lowbar;TYPE&gt;
static
int
putIntegerGivenLength(
    std::streambuf* streamBuf,
    INTEGRAL&lowbar;TYPE value,
    int length);
----

== Description

output sequence of the specified `streamBuf`&period; Return 0 if successful, and a non&hyphen;zero value otherwise&period; The operation succeeds if all bytes corresponding to the contents octets are written to the `streamBuf` without the write position becoming unavailable&period; The behavior is undefined unless there are exactly `length` number of contents octets used to encode the integer `value` according to the specification&period; The program is ill&hyphen;formed unless the specified `INTEGRAL&lowbar;TYPE` is a fundamental integral type&period;

== Return Value

0 on success, and a non&hyphen;zero value otherwise

== Parameters

[cols="1,4"]
|===
| Name| Description
| *streamBuf*
| output stream buffer
| *value*
| value to encode
| *length*
| number of content octets
|===


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