[#BloombergLP-bdlma-BufferImpUtil-allocateFromBuffer] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlma.adoc[bdlma]::xref:BloombergLP/bdlma/BufferImpUtil.adoc[BufferImpUtil]::allocateFromBuffer :relfileprefix: ../../../ :mrdocs: Allocate a memory block of the specified `size` (in bytes) from the specified `buffer` having the specified `bufferSize` (in bytes) at the specified `cursor` position, using the specified alignment `strategy`. Return the address of the allocated memory block if `buffer` contains sufficient available memory, and 0 otherwise. The `cursor` is set to the first byte position immediately after the allocated memory if there is sufficient memory, and not modified otherwise. The behavior is undefined unless `0 < size`, `0 <= *cursor`, and `*cursor <= bufferSize`. == Synopsis Declared in `<bdlma_bufferimputil.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static void* allocateFromBuffer( xref:BloombergLP/bsls/Types/IntPtr.adoc[bsls::Types::IntPtr]* cursor, char* buffer, xref:BloombergLP/bsls/Types/size_type.adoc[bsls::Types::size_type] bufferSize, xref:BloombergLP/bsls/Types/size_type.adoc[bsls::Types::size_type] size, xref:BloombergLP/bsls/Alignment/Strategy.adoc[bsls::Alignment::Strategy] strategy); ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#