You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -112,18 +112,18 @@ Note: The preprocessor definitions are taken into account when compiling `printf
112
112
The library offers the following, with the same signatures as in the standard C library (plus an extra underscore):
113
113
```
114
114
int printf_(const char* format, ...);
115
-
int sprintf_(char* buffer, const char* format, ...);
116
-
int vsprintf_(char* buffer, const char* format, va_list va);
117
-
int snprintf_(char* buffer, size_t count, const char* format, ...);
118
-
int vsnprintf_(char* buffer, size_t count, const char* format, va_list va);
119
-
int vprintf_(const char* format, va_list va);
115
+
int sprintf_(char* s, const char* format, ...);
116
+
int vsprintf_(char* s, const char* format, va_list arg);
117
+
int snprintf_(char* s, size_t n, const char* format, ...);
118
+
int vsnprintf_(char* s, size_t n, const char* format, va_list arg);
119
+
int vprintf_(const char* format, va_list arg);
120
120
```
121
121
Note that `printf()` and `vprintf()` don't actually write anything on their own: In addition to their parameters, you must provide them with a lower-level `putchar_()` function which they can call for actual printing. This is part of this library's independence: It is isolated from dealing with console/serial output, files etc.
122
122
123
123
Two additional functions are provided beyond those available in the standard library:
124
124
```
125
-
int fctprintf(void (*out)(char character, void* arg), void* arg, const char* format, ...);
126
-
int vfctprintf(void (*out)(char character, void* arg), void* arg, const char* format, va_list va);
125
+
int fctprintf(void (*out)(char c, void* extra_arg), void* extra_arg, const char* format, ...);
126
+
int vfctprintf(void (*out)(char c, void* extra_arg), void* extra_arg, const char* format, va_list arg);
127
127
```
128
128
These higher-order functions allow for better flexibility of use: You can decide to do different things with the individual output characters: Encode them, compress them, filter them, append them to a buffer or a file, or just discard them. This is achieved by you passing a pointer to your own state information - through `(v)fctprintf()` and all the way to your own `out()` function.
0 commit comments