Function anj_persistence_string

Function Documentation

int anj_persistence_string(const anj_persistence_context_t *ctx, char *inout_str, size_t out_max_size)

Stores or restores a NUL-terminated string.

  • In STORE mode: writes the string pointed to by inout_str excluding the terminating NUL byte, and its length as a 64-bit unsigned integer.

  • In RESTORE mode: reads a NUL-terminated string into inout_str, writing at most out_max_size bytes (including the terminator). The result is guaranteed to be NUL-terminated if the call succeeds.

Parameters:
  • ctx – Persistence context.

  • inout_str[inout] String to write or destination buffer.

  • out_max_size – Size of inout_str (RESTORE). Ignored in STORE.

Returns:

0 on success, negative value on error.