aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/eina/src/examples/eina_file_01.c
blob: 6490b623c21a7f6a00a85a0d7722a9178e613ed3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//Compile with:
//gcc -g `pkg-config --cflags --libs eina` eina_file_01.c -o eina_file_01

#include <stdio.h>
#include <Eina.h>

static void
_print_cb(const char *name, const char *path, void *data)
{
   printf("file %s in %s\n", name, path);
}

int
main(int argc, char **argv)
{
   Eina_Iterator *it;
   const char *f_name;
   const Eina_File_Direct_Info *f_info;

   eina_init();

   eina_file_dir_list("/home/", EINA_FALSE, _print_cb, NULL);

   it = eina_file_ls("/home/");
   EINA_ITERATOR_FOREACH(it, f_name)
     {
        printf("%s\n", f_name);
        eina_stringshare_del(f_name);
     }
   eina_iterator_free(it);

   it = eina_file_stat_ls("/home/");
   EINA_ITERATOR_FOREACH(it, f_info)
     printf("%s if of type %d\n", f_info->path, f_info->type);
   eina_iterator_free(it);

   it = eina_file_direct_ls("/home/");
   EINA_ITERATOR_FOREACH(it, f_info)
     printf("%s if of type %d\n", f_info->path, f_info->type);
   eina_iterator_free(it);

   eina_shutdown();

   return 0;
}