mirror of
https://github.com/tailix/libkernaux.git
synced 2024-12-11 11:35:27 -05:00
Improve examples
This commit is contained in:
parent
de6e1a02d4
commit
75a573a9e0
2 changed files with 2 additions and 10 deletions
|
@ -8,7 +8,7 @@
|
|||
#define BUFFER_SIZE 1024
|
||||
|
||||
static char buffer[BUFFER_SIZE];
|
||||
static unsigned int buffer_index;
|
||||
static unsigned int buffer_index = 0;
|
||||
|
||||
static void my_putchar(const char chr)
|
||||
{
|
||||
|
@ -18,12 +18,8 @@ static void my_putchar(const char chr)
|
|||
|
||||
int main()
|
||||
{
|
||||
memset(buffer, '\0', sizeof(buffer));
|
||||
buffer_index = 0;
|
||||
kernaux_printf(my_putchar, "Hello, %s! Session ID: %u.", "Alex", 123);
|
||||
assert(strcmp(buffer, "Hello, Alex! Session ID: 123.") == 0);
|
||||
|
||||
printf("OK!\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#define BUFFER_SIZE 1024
|
||||
|
||||
static char buffer[BUFFER_SIZE];
|
||||
static unsigned int buffer_index;
|
||||
static unsigned int buffer_index = 0;
|
||||
|
||||
static void my_putchar(const char chr)
|
||||
{
|
||||
|
@ -26,12 +26,8 @@ static void my_printf(const char *const format, ...)
|
|||
|
||||
int main()
|
||||
{
|
||||
memset(buffer, '\0', sizeof(buffer));
|
||||
buffer_index = 0;
|
||||
my_printf("Hello, %s! Session ID: %u.", "Alex", 123);
|
||||
assert(strcmp(buffer, "Hello, Alex! Session ID: 123.") == 0);
|
||||
|
||||
printf("OK!\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue