#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
Go to the source code of this file.
|
int | printf (const char *format,...) |
|
int | sprintf (char *buffer, const char *format,...) |
|
int | snprintf (char *buffer, size_t count, const char *format,...) |
|
int | vsnprintf (char *buffer, size_t count, const char *format, va_list va) |
|
int | fctprintf (void(*out)(char character, void *arg), void *arg, const char *format,...) |
|
◆ _putchar
Output a character to a custom device like UART, used by the printf() function This function is declared here only. You have to write your custom implementation somewhere
- Parameters
-
character | Character to output |
◆ fctprintf()
int fctprintf |
( |
void(*)(char character, void *arg) |
out, |
|
|
void * |
arg, |
|
|
const char * |
format, |
|
|
|
... |
|
) |
| |
printf with output function You may use this as dynamic alternative to printf() with its fixed _putchar() output
- Parameters
-
out | An output function which takes one character and an argument pointer |
arg | An argument pointer for user data passed to output function |
format | A string that specifies the format of the output |
- Returns
- The number of characters that are sent to the output function, not counting the terminating null character
◆ printf()
int printf |
( |
const char * |
format, |
|
|
|
... |
|
) |
| |
Tiny printf implementation You have to implement _putchar if you use printf()
- Parameters
-
format | A string that specifies the format of the output |
- Returns
- The number of characters that are written into the array, not counting the terminating null character
◆ snprintf()
int snprintf |
( |
char * |
buffer, |
|
|
size_t |
count, |
|
|
const char * |
format, |
|
|
|
... |
|
) |
| |
Tiny snprintf/vsnprintf implementation
- Parameters
-
buffer | A pointer to the buffer where to store the formatted string |
count | The maximum number of characters to store in the buffer, including a terminating null character |
format | A string that specifies the format of the output |
- Returns
- The number of characters that are WRITTEN into the buffer, not counting the terminating null character If the formatted string is truncated the buffer size (count) is returned
◆ sprintf()
int sprintf |
( |
char * |
buffer, |
|
|
const char * |
format, |
|
|
|
... |
|
) |
| |
Tiny sprintf implementation Due to security reasons (buffer overflow) YOU SHOULD CONSIDER USING (V)SNPRINTF INSTEAD!
- Parameters
-
buffer | A pointer to the buffer where to store the formatted string. MUST be big enough to store the output! |
format | A string that specifies the format of the output |
- Returns
- The number of characters that are WRITTEN into the buffer, not counting the terminating null character
◆ vsnprintf()
int vsnprintf |
( |
char * |
buffer, |
|
|
size_t |
count, |
|
|
const char * |
format, |
|
|
va_list |
va |
|
) |
| |