Function anjay_get_string
Defined in File io.h
Function Documentation
-
int anjay_get_string(anjay_input_ctx_t *ctx, char *out_buf, size_t buf_size)
Reads a null-terminated string from the request content. On success or even when ANJAY_BUFFER_TOO_SHORT is returned, the content inside
out_bufis always null-terminated. On failure, the contents ofout_bufare undefined.When the input buffer is not big enough to contain whole message content + terminating nullbyte, ANJAY_BUFFER_TOO_SHORT is returned, after which further calls can be made, to retrieve more data.
- Parameters:
ctx – Input context to operate on.
out_buf – [out] Buffer to read data into.
buf_size – Number of bytes available in
out_buf. Must be at least 1.
- Returns:
0 on success, a negative value in case of error, ANJAY_BUFFER_TOO_SHORT if the buffer is not big enough to contain whole message content + terminating nullbyte.