summaryrefslogtreecommitdiff
path: root/src/examples/emile/emile_base64.c
diff options
context:
space:
mode:
authorSrivardhan Hebbar <sri.hebbar@samsung.com>2016-01-14 11:28:40 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-01-14 11:28:40 +0900
commit46fd6307b2561b575c196919a38b0ec1ae83dada (patch)
tree0ff3693a3fc99d95a7d4a2ceb330078cbea5cf4a /src/examples/emile/emile_base64.c
parent63a410667a847c7ea90c77a83d94175716935d14 (diff)
emile: Added example program for base64 encoding and decoding.
Summary: Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com> Reviewers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D3554
Diffstat (limited to 'src/examples/emile/emile_base64.c')
-rw-r--r--src/examples/emile/emile_base64.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/examples/emile/emile_base64.c b/src/examples/emile/emile_base64.c
new file mode 100644
index 0000000000..0f175abe93
--- /dev/null
+++ b/src/examples/emile/emile_base64.c
@@ -0,0 +1,29 @@
1//Compile with:
2//gcc -Wall -o emile_base64 emile_base64.c `pkg-config --cflags --libs eina emile`
3
4#include <stdio.h>
5#include <Eina.h>
6#include <Emile.h>
7
8int main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
9{
10 Eina_Strbuf *b64;
11 Eina_Binbuf *decoded;
12 Eina_Binbuf *str;
13
14 eina_init();
15
16 str = eina_binbuf_new();
17 eina_binbuf_append_length(str, (unsigned char *)"Enlightenment", 13);
18 b64 = emile_base64_encode(str);
19 printf("%s\n", eina_strbuf_string_get(b64));
20 decoded = emile_base64_decode(b64);
21 printf("decoded string: %s\n", eina_binbuf_string_get(decoded));
22 eina_strbuf_free(b64);
23 eina_binbuf_free(decoded);
24
25 eina_binbuf_free(str);
26 eina_shutdown();
27
28 return 0;
29}