eina: add example for eina_tmpstr.
Summary: Example for eina_tmpstr added. Example tests for eina_tmpstr_add_length, eina_tmpstr_len, eina_tmpstr_del and eina_tmpstr_strftime APIs Signed-Off By: Shilpa Singh <shilpa.singh@samsung.com> Reviewers: cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D3087 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
This commit is contained in:
parent
6eefe25dcf
commit
65758a2160
|
@ -39,6 +39,7 @@ eina_inlist_03.c \
|
|||
eina_str_01.c \
|
||||
eina_strbuf_01.c \
|
||||
eina_stringshare_01.c \
|
||||
eina_tmpstr_01.c \
|
||||
eina_tiler_01.c \
|
||||
eina_simple_xml_parser_01.c \
|
||||
eina_value_01.c \
|
||||
|
@ -84,6 +85,7 @@ eina_inlist_03 \
|
|||
eina_str_01 \
|
||||
eina_strbuf_01 \
|
||||
eina_stringshare_01 \
|
||||
eina_tmpstr_01 \
|
||||
eina_magic_01 \
|
||||
eina_simple_xml_parser_01 \
|
||||
eina_value_01 \
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
//Compile with:
|
||||
//gcc -g eina_tmpstr_01.c -o eina_tmpstr_01 `pkg-config --cflags --libs eina`
|
||||
|
||||
#include <stdio.h>
|
||||
#include <Eina.h>
|
||||
|
||||
int
|
||||
main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
||||
{
|
||||
const char *str, *str2;
|
||||
time_t curr_time;
|
||||
struct tm * info;
|
||||
const char *prologe = "The Cylons were created by man. They rebelled. They "
|
||||
"evolved.";
|
||||
|
||||
eina_init();
|
||||
|
||||
str = eina_tmpstr_add_length(prologe, 31);
|
||||
printf("%s\n", str);
|
||||
printf("length: %d\n", eina_tmpstr_len(str));
|
||||
eina_tmpstr_del(str);
|
||||
|
||||
curr_time = time(NULL);
|
||||
info = localtime(&curr_time);
|
||||
str2 = eina_tmpstr_strftime("%I:%M%p", info);
|
||||
printf("%s\n", str2);
|
||||
printf("length: %d\n", eina_tmpstr_len(str2));
|
||||
eina_tmpstr_del(str2);
|
||||
|
||||
eina_shutdown();
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue