rcutils  master
C API providing common utilities and data structures.
Functions
strerror.h File Reference
#include "rcutils/visibility_control.h"
Include dependency graph for strerror.h:

Go to the source code of this file.

Functions

void rcutils_strerror (char *buffer, size_t buffer_length)
 Retrieve the string corresponding to the last system error. More...
 

Function Documentation

◆ rcutils_strerror()

void rcutils_strerror ( char *  buffer,
size_t  buffer_length 
)

Retrieve the string corresponding to the last system error.

This function retrieves the value of errno, and calls the system-specific equivalent of strerror on it, storing the output in the provided buffer. If the error message is longer than the buffer, it will be truncated. The memory for the c-string buffer that is passed in must be managed by the caller.

This function is thread-safe.

Parameters
[in,out]bufferThe buffer in which to store the data
[in]buffer_lengththe maximum length of the buffer