istream_read_until_delimiter()#
Configures the istream to read data until a specified delimiter is encountered. Once the delimiter is matched, the specified event (event) is triggered for the associated GObj.
Prototype
PUBLIC int istream_read_until_delimiter(
istream_h istream,
const char *delimiter,
size_t delimiter_size,
gobj_event_t event
);
Parameters
Key |
Type |
Description |
|---|---|---|
|
|
The handle to the istream where data will be read. |
|
|
A pointer to the delimiter string to match in the incoming data. |
|
|
The size (in bytes) of the delimiter. |
|
|
The event to be triggered when the delimiter is matched. This must be a unique pointer. |
Return Value
Returns 0 on successful configuration.
Returns -1 if:
istreamis invalid.Memory allocation for the delimiter fails.
delimiter_sizeis0or less.
Notes
The function performs the following steps:
Validates the input parameters.
Allocates memory for the
delimiterand copies its contents.Configures the
eventto be triggered when the delimiter is matched.Resets the reading mode and any previously configured
num_bytes.
The
eventmust be a unique pointer to allow optimized comparison during event dispatching.Ensure that the
delimiterand itsdelimiter_sizeaccurately represent the boundary condition for data parsing.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples