FastLED 3.9.15
Loading...
Searching...
No Matches

◆ sprintf()

template<fl::size N, typename... Args>
int fl::sprintf ( char(&) buffer[N],
const char * format,
const Args &... args )

Sprintf-like formatting function that writes to a buffer.

Parameters
bufferOutput buffer to write formatted string to
formatFormat string with placeholders like "%d", "%s", "%f" etc.
argsArguments to format
Returns
Number of characters written (excluding null terminator)

This function writes a formatted string to the provided buffer. The buffer size is deduced at compile time from the array reference, providing automatic safety against buffer overflows.

Example usage:

char buffer[100];
int len = fl::sprintf(buffer, "Value: %d, Name: %s", 42, "test");
int sprintf(char(&buffer)[N], const char *format, const Args &... args)
Sprintf-like formatting function that writes to a buffer.
Definition printf.h:468

Definition at line 468 of file printf.h.

468 {
469 // Use the compile-time known buffer size for safety
470 return snprintf(buffer, N, format, args...);
471}
int snprintf(char *buffer, fl::size size, const char *format, const Args &... args)
Snprintf-like formatting function that writes to a buffer.
Definition printf.h:422
corkscrew_args args
Definition old.h:150

References args, and snprintf().

+ Here is the call graph for this function: