Table Of Contents

Previous topic

String Functions

Next topic

Regular Expressions

String Printing Functions

UTF8 string printing functions.

Summary

s_vsprintf Print a variable argument list to a UTF-8 string buffer.
s_vszprintf Print a variable argument list to a UTF-8 string buffer (handles size).
s_vasprintf Print a variable argument list to a UTF-8 string buffer (allocates memory).
s_sprintf Print a formatted UTF-8 string to a buffer.
s_szprintf Print a formatted UTF-8 string to a buffer (handles size).
s_asprintf Print a formatted UTF-8 string to a buffer (allocates memory).

Variable Argument List

macro s_vsprintf(buf, format, args, error)

Print a variable argument list to a UTF-8 string buffer.

This function does not handle the size of the buffer.

Parameters:
  • buf

    The buffer to print to.

  • format

    The format of the output.

  • args

    The variable argument list.

  • error

    Error code.

Return:

The number of characters printed.

See also:

s_vszprintf

int s_vszprintf(char *buf, size_t count, const char *format, va_list args, s_erc *error)

Print a variable argument list to a UTF-8 string buffer (handles size).

The size of the buffer is specified with count.

Parameters:
  • buf

    The buffer to print to.

  • count

    Not more than count characters will be printed to the buffer.

  • format

    The format of the output.

  • args

    The variable argument list.

  • error

    Error code.

Return:

The number of characters printed.

int s_vasprintf(char **ret, const char *format, va_list args, s_erc *error)

Print a variable argument list to a UTF-8 string buffer (allocates memory).

Allocates memory to buffer as required. Uses s_vsprintf internally.

Parameters:
  • ret

    The buffer to print to.

  • format

    The format of the output.

  • args

    The variable argument list.

  • error

    Error code.

Return:

The number of characters printed.

Note:

This function is slower than s_vsprintf.

Formatted String

int s_sprintf(char *buf, s_erc *error, const char *format, ...)

Print a formatted UTF-8 string to a buffer.

This function does not handle the size of the buffer. Uses s_vsprintf internally.

Parameters:
  • buf

    The buffer to print to.

  • error

    Error code.

  • format

    The format of the output.

Return:

The number of characters printed.

int s_szprintf(char *buf, size_t count, s_erc *error, const char *format, ...)

Print a formatted UTF-8 string to a buffer (handles size).

This function can handle the size of the buffer. Uses s_vszprintf internally.

Parameters:
  • buf

    The buffer to print to.

  • format

    The format of the output.

  • error

    Error code.

  • count

    Not more than count characters will be printed to the buffer.

Return:

The number of characters printed.

int s_asprintf(char **ret, s_erc *error, const char *fmt, ...)

Print a formatted UTF-8 string to a buffer (allocates memory).

Allocates memory to buffer as required. Uses s_vasprintf internally.

Parameters:
  • ret

    The buffer to print to.

  • error

    Error code.

  • fmt

    The formatted output.

Return:

The number of characters printed.

Note:

This function is slower than s_sprintf.