[#BloombergLP-bslx-GenericInStream-getLength]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslx.adoc[bslx]::xref:BloombergLP/bslx/GenericInStream.adoc[GenericInStream]::getLength
:relfileprefix: ../../../
:mrdocs:

Extract a BDEX&hyphen;encoded length into the specified `length`&period;

== Synopsis

Declared in `&lt;bslx&lowbar;genericinstream&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bslx/GenericInStream.adoc[GenericInStream&lt;STREAMBUF&gt;]&
getLength(int& length);
----

== Description

If the most&hyphen;significant bit of the one byte of this stream at the current cursor location is set, assign to the specified `length` the four&hyphen;byte, two&apos;s complement integer (in host byte order) comprised of the four bytes of this stream at the current cursor location (in network byte order) with the most&hyphen;significant bit unset&semi; otherwise, assign to `length` the one&hyphen;byte, two&apos;s complement integer comprised of the one byte of this stream at the current cursor location&period; Update the cursor location and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period; If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of `length` is undefined&period; Note that the value will be zero&hyphen;extended&period;

== Return Value

a reference to this stream

== Parameters

[cols="1,4"]
|===
| Name| Description
| *length*
| destination for the extracted length
|===


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