Function rcutils_char_array_strcpy

Function Documentation

rcutils_ret_t rcutils_char_array_strcpy(rcutils_char_array_t *char_array, const char *src)

Copy a string to buffer.

This function is equivalent to strcpy(char_array->buffer, src) except that the buffer grows as needed so that src will fit without overflow.

Parameters:
  • char_array[inout] pointer to the instance of rcutils_char_array_t which is being copied to

  • src[in] the string to be copied from

Returns:

RCUTILS_RET_OK if successful, or

Returns:

RCUTILS_RET_BAD_ALLOC if memory allocation failed, or

Returns:

RCUTILS_RET_ERROR if an unexpected error occurs.