1 //Compile with:
2 //gcc -g eina_file_01.c -o eina_file_01 `pkg-config --cflags --libs eina`
3
4 #include <stdio.h>
5 #include <Eina.h>
6
7 static void
_print_cb(const char * name,const char * path,void * data EINA_UNUSED)8 _print_cb(const char *name, const char *path, void *data EINA_UNUSED)
9 {
10 printf("file %s in %s\n", name, path);
11 }
12
13 int
main(int argc EINA_UNUSED,char ** argv EINA_UNUSED)14 main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
15 {
16 Eina_Iterator *it;
17 const char *f_name;
18 const Eina_File_Direct_Info *f_info;
19
20 eina_init();
21
22 eina_file_dir_list("/home/", EINA_FALSE, _print_cb, NULL);
23
24 it = eina_file_ls("/home/");
25 EINA_ITERATOR_FOREACH(it, f_name)
26 {
27 printf("%s\n", f_name);
28 eina_stringshare_del(f_name);
29 }
30 eina_iterator_free(it);
31
32 it = eina_file_stat_ls("/home/");
33 EINA_ITERATOR_FOREACH(it, f_info)
34 printf("%s if of type %d\n", f_info->path, f_info->type);
35 eina_iterator_free(it);
36
37 it = eina_file_direct_ls("/home/");
38 EINA_ITERATOR_FOREACH(it, f_info)
39 printf("%s if of type %d\n", f_info->path, f_info->type);
40 eina_iterator_free(it);
41
42 eina_shutdown();
43
44 return 0;
45 }
46