io1: Add printf examples

Signed-off-by: Louis Solofrizzo <lsolofrizzo@online.net>
This commit is contained in:
Louis Solofrizzo 2019-04-24 12:08:25 +02:00
parent 4cf27f5081
commit e7c0133eac
2 changed files with 28 additions and 0 deletions

View file

@ -0,0 +1,3 @@
export ukl-obj-m := main.o
include ../../Makefile

View file

@ -0,0 +1,25 @@
#include <stdio.h>
#ifndef USERSPACE
#define main ukl_main
#endif
typedef struct {
char a;
char *b;
int c;
} test_t;
int main(void) {
char str[250];
test_t test = {
.a = 'a',
.b = "Hello!",
.c = 10
};
printf("a = %c, b = %s, c = %d\n", test.a, test.b, test.c);
snprintf(str, sizeof(str), "a = %c, b = %s, c = %d\n", test.a, test.b, test.c);
puts(str);
return 0;
}