Function amqp_cstring_bytes

Synopsis

#include <librabbitmq/amqp.h>

amqp_bytes_t amqp_cstring_bytes(char const *cstr)

Description

Wraps a c string in an amqp_bytes_t

Takes a string, calculates its length and creates an amqp_bytes_t that points to it. The string is not duplicated.

For a given input cstr, The amqp_bytes_t output.bytes is the same as cstr, output.len is the length of the string not including the \0 terminator

This function uses strlen() internally so cstr must be properly terminated

Parameters:

[ in ] cstr - the c string to wrap

Return
an amqp_bytes_t that describes the string
Since
v0.1

Mentioned in

Source

Lines 167-172 in librabbitmq/amqp_mem.c. Line 971 in librabbitmq/amqp.h.

amqp_bytes_t amqp_cstring_bytes(char const *cstr) {
  amqp_bytes_t result;
  result.len = strlen(cstr);
  result.bytes = (void *)cstr;
  return result;
}





Add Discussion as Guest

Log in to DocsForge