Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards


read_until (4 of 24 overloads)

Read data into a dynamic buffer sequence until it contains a specified delimiter.

    typename SyncReadStream,
    typename DynamicBuffer_v1>
std::size_t read_until(
    SyncReadStream & s,
    DynamicBuffer_v1 && buffers,
    string_view delim,
    boost::system::error_code & ec,
    constraint_t< is_dynamic_buffer_v1< decay_t< DynamicBuffer_v1 > >::value >  = 0,
    constraint_t< !is_dynamic_buffer_v2< decay_t< DynamicBuffer_v1 > >::value >  = 0);

This function is used to read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains the specified delimiter. The call will block until one of the following conditions is true:

This operation is implemented in terms of zero or more calls to the stream's read_some function. If the dynamic buffer sequence's get area already contains the delimiter, the function returns immediately.



The stream from which the data is to be read. The type must support the SyncReadStream concept.


The dynamic buffer sequence into which the data will be read.


The delimiter string.


Set to indicate what error occurred, if any.

Return Value

The number of bytes in the dynamic buffer sequence's get area up to and including the delimiter. Returns 0 if an error occurred.


After a successful read_until operation, the dynamic buffer sequence may contain additional data beyond the delimiter. An application will typically leave that data in the dynamic buffer sequence for a subsequent read_until operation to examine.