Skip to content

Commit

Permalink
Add absolute minimal example
Browse files Browse the repository at this point in the history
  • Loading branch information
MaJerle committed Aug 23, 2020
1 parent 357de33 commit f85ac07
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dev/VisualStudio/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* \return `ch` value on success, `0` otherwise
*/
int
lwprintf_output(int ch, struct lwprintf* lw) {
lwprintf_output(int ch, lwprintf_t* lw) {
printf("%c", (char)ch);
return ch;
}
Expand Down
19 changes: 19 additions & 0 deletions docs/examples_src/example_minimal.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "lwprintf/lwprintf.h"

/* Called for every character to be printed */
int
lwprintf_out(int ch, lwprintf_t* lwp) {
/* May use printf to output it for test */
printf("%c", (char)ch);

return ch;
}

int
main(void) {
/* Initialize default lwprintf instance with output function */
lwprintf_init(lwprintf_out);

/* Print first text */
lwprintf_printf("Text: %d", 10);
}

0 comments on commit f85ac07

Please sign in to comment.